Can you help me w/ C++ - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Other (
https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (
https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: Can you help me w/ C++ (
/showthread.php?tid=562154)
Can you help me w/ C++ -
Arastair - 07.02.2015
Hello,
This is the code:
http://s8.postimg.org/wlfr18ns5/scre...t_18_29_54.jpg
what the code does is: compare previous and current word in a while loop and then if the IF statement is true it executes whatever is in there
Please tell me how could previous be assigned current's value and used before the IF statement?
If you type Test Test the if statement would be true
Cheerio
Re: Can you help me w/ C++ -
ikkentim - 07.02.2015
"Please tell me how could previous be assigned current's value and used before the IF statement?"
Just use current? That would be the next previous value, or do I simply not understand your question?
Re: Can you help me w/ C++ -
Arastair - 07.02.2015
I'll try to explain it in another way to you
Re: Can you help me w/ C++ -
GWMPT - 07.02.2015
Maybe something like:
PHP код:
int main(int argc, char **argv) {
std::string current;
std::string previous;
do {
std::cin >> current;
if (current == previous) { // the previous word and the current one are the same
std::cout << "The word entered is the same as the old one." << std::endl;
continue; // Continue the loop without executing the instructions below
}
// The previous word and the current one are different.
previous = current;
std::cout << "The word entered is different from the old one." << std::endl;
} while (current != "exit");
return 0;
}
?