   Need help with QandA program
  ok i wrote up this code and it gets through the compiler but it wont work its in C++what do you think is wronghere is the code#include <iostream>using namespace std;int main(){int a;cout << "What time of day is it?\n";cout << "1) Morning\n";cout << "2) Afternoon\n";cout << "3) Evening\n";cout << "Enter a choice: ";cin >> a;switch (a){case 1:cout << "Good Morning!";break;case 2:cout << "Good Afternoon!";break;case 3:cout << "Good Evening!";break;default:cout << "Not a valid entry...";break;}}   
Quote:ok i wrote up this code and it gets through the compiler but it wont work its in C++Describe how it doesn't work. Is it outputting the wrong thing? Is there any output?   ;  I'm assuming by "wont work" he means "The program closes before I get to see the output after entering an integer."What's happening is that the console window is closed when your program finishes executing.  If you want to pause the output window so you can observe the output, try any of the following:1)  Place a breakpoint on the closing brace of your main function, if your IDE has debugging features.2)  Adding cin.ignore(1); cin.get(); before the end of your main function.  (The ignore eats the newline left when entering your integer)3)  Include <cstdlib> and add system("pause"); before the end of your main function.4)  Run your program from a command line.  I.e. open up a console terminal, and manually execute your program from that window.   ;  ok so i tried option 2 and 3 but don't understand 1 or 4and your right it opens says what time of day is it and to inter a number for an answer but when i put 1,2,3,or any other number then hit enter the program closes same for options 2 and 3   