Hey, I'm new to programming, I was following those tutorials and built upon that this:
It does nothing useful in particular, but when I enter something above 4 it loops like its supposed to but it continues to select 4 at the menu, can I reset the integer input somehow?Code:#include <iostream> using namespace std; int main() { int input; cout<<"1. Message number one.\n"; cout<<"2. Message number two.\n"; cout<<"3. Message number three.\n"; cout<<"4. Exit.\n"; cin>> input; do { switch ( input ) { case 1: cout<<"Meeting on Monday.\n"; break; case 2: cout<<"Tuesday is open.\n"; break; case 3: cout<<"Wednesday is full.\n"; break; case 4: cout<<"Check back for messages later! Goodbye!\n"; break; default: cout<<"Sorry, invalid input, terminating!"; break; } } while ( input > 4 ); cin.get(); }
Thanks.