|
From: Jason S. <mys...@op...> - 2002-02-11 20:41:22
|
Try using this,
#include <iostream.h>
int main()
{
int thisisanumber;
cout<<"Please enter a number:";
cin>>thisisanumber;
cout<<"You entered: "<<thisisanumber<<endl;
cin.get()
return 0;
}
I don't have access to any compilers at the moment, but I believe you need a endl or the such there...not quite sure though. :)
Jason
----- Original Message -----
From: aar...@ut...
To: dev...@li...
Sent: Monday, February 11, 2002 3:28 PM
Subject: [Dev-C++] Dev C++ Question
However for the following code, I type my number, press enter, and the window
closes immediately. Why doesn't the compiler display "You entered: ", then my
number, and then close the terminal window once I push enter (which would be
the second time)?? Am I putting the cin.get() statement in the wrong spot??
Check out the code I'm using.
#include <iostream.h>
int main()
{
int thisisanumber;
cout<<"Please enter a number:";
cin>>thisisanumber;
cout<<"You entered: "<<thisisanumber;
cin.get()
return 0;
}
|