Hey I just started learning c++ and am onto the page on switch cases on cprogramming.com but cant get it to work.
Can somebody please expain where I've gone wrong here:
#include <iostream>
using namespace std;
int main ()
{
int x;
cout<< "Pick a number: 1 or 2: ";
cin>> x;
switch ( x ) {
case 1:
cout<< "You chose 1, correct!";
break;
case 2:
cout<< "You chose 2, fail!";
break;
default:
cout<< "doesnt work\n";
break;
}
cin.get();
}