Can you help me w/ C++
#4

Maybe something like:
PHP код:
int main(int argcchar **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;

?
Reply


Messages In This Thread
Can you help me w/ C++ - by Arastair - 07.02.2015, 11:01
Re: Can you help me w/ C++ - by ikkentim - 07.02.2015, 12:45
Re: Can you help me w/ C++ - by Arastair - 07.02.2015, 13:57
Re: Can you help me w/ C++ - by GWMPT - 07.02.2015, 14:48

Forum Jump:


Users browsing this thread: 1 Guest(s)