Any suggestions?
-
Hi all. Im trying to make a function to try to attempt something, but when it fails try "one" more time and then move on to the next thing. So far i've made something that doesnt look close to what i have to do.
#include #include #include using namespace std; int main() { string test="Testing this"; string test1="Testing the other side"; if(test == test1){ while(test == test1){ Sleep(9000); cout << "Match " << endl; } } else{ cout << "No match! " << endl; } return 0; }
Any suggestions? Thanx in advance! -
Hi all. Im trying to make a function to try to attempt something, but when it fails try "one" more time and then move on to the next thing. So far i've made something that doesnt look close to what i have to do.
#include #include #include using namespace std; int main() { string test="Testing this"; string test1="Testing the other side"; if(test == test1){ while(test == test1){ Sleep(9000); cout << "Match " << endl; } } else{ cout << "No match! " << endl; } return 0; }
Any suggestions? Thanx in advance!Well the “while” loop will run forever, unless you end the process via the “Windows Task Manager”, because neither string is ever going to change. Of course you do not need to worry about that, because “test” is never going to equal “test1”, so the “while” loop will never run. I recommend that next time you try to explain what you are attempting to do. The odds are that someone who frequents CP has already tried it.
INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
-
Hi all. Im trying to make a function to try to attempt something, but when it fails try "one" more time and then move on to the next thing. So far i've made something that doesnt look close to what i have to do.
#include #include #include using namespace std; int main() { string test="Testing this"; string test1="Testing the other side"; if(test == test1){ while(test == test1){ Sleep(9000); cout << "Match " << endl; } } else{ cout << "No match! " << endl; } return 0; }
Any suggestions? Thanx in advance!Try this one -
CString test="Testing this";
CString test1="Testing the other side";
int count = 0;
while (test != test1)//wait until some other thread make test equal to test1
{
Sleep(90);
if (count++ == 10)//or wait until the count is not equal to 100
break;
} -
Hi all. Im trying to make a function to try to attempt something, but when it fails try "one" more time and then move on to the next thing. So far i've made something that doesnt look close to what i have to do.
#include #include #include using namespace std; int main() { string test="Testing this"; string test1="Testing the other side"; if(test == test1){ while(test == test1){ Sleep(9000); cout << "Match " << endl; } } else{ cout << "No match! " << endl; } return 0; }
Any suggestions? Thanx in advance!dellthinker wrote:
Im trying to make a function to try to attempt something...
Such as? :confused:
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne