07.02.2015, 14:48
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;
}