I am a new C++ programmer. I started out using a Borland compiler, which I found worked rather well. I just made a few simple things, including a nice ASCII version of tic-tack-toe with computer A.I. But I recently had the oppurtunity to get Visual Studio .Net with all the newest Microsoft tools.
Well, after much toil, I figured out how to make a simple, blank console program. Then I typed in some code. This code, to be exact:
Code:
#include <iostream.h>
int main()
{
int a, b;
cout<<"1\n";
cin>>a;
cout<<"\n2\n";
cin>>b;
return 0;
}
Seems, simple, right? But what happens is, it outputs "1,", then lets me input something... the the program ends. Too fast to even see if it ouputs a 2.
After staring at the code for about an hour, I decided to try it in Borland and the same thing happened! I opened up my old tic tac toe program and it worked fine (although I don't remember using cin for that...) Am I going crazy??? What's wrong here?? Anyone have a similar problem??