Greetings,
Noob here. I've recently started trying to learn C++. It would also be my first language to learn, so, I'm a major noob. Bare with me.
In this code I wrote, testing out the things the first two lessons on this site taught me, the program just ends without me pressing enter. Cin.get(); is supposed to have it where you press enter to end the program right? So what am I doing wrong?
I'm writing the code in Visual C++ 2005 Express Edition, and compiling it in the command line compiler that comes with it.Code:#include <iostream>
using namespace std;
int main()
{
int a;
label:
cout<<"Password: ";
cin>> a;
if ( a == 8759 ) {
cout<<"Access granted.\n";
}
else {
cout<<"Your password entry is incorrect. Try again.\n\n";
goto label;
}
cin.get();
}
Any help would be appreciated
-J.P.