I have this:
#include <iostream.h>
int
main()
{
int thisisanumber;
cout<<"Please enter a number:";
cin>>thisisanumber;
cout<<"You entered: "<<thisisanumber;
return 0;
}
When I run it I get a line that says Please enter a number:
I enter a number and the prompt closes.
I tryed doing this and got an error:
#include <iostream.h>
#include <stdlib.h>
int
main()
{
int thisisanumber;
cout<<"Please enter a number:";
cin>>thisisanumber;
cout<<"You entered: "<<thisisanumber;
system("PAUSE");
return 0;
}
Is this way off?
Quote from: muert0 on July 03, 2004, 09:14 PM
I have this:
#include <iostream.h>
int
main()
{
int thisisanumber;
cout<<"Please enter a number:";
cin>>thisisanumber;
cout<<"You entered: "<<thisisanumber;
return 0;
}
When I run it I get a line that says Please enter a number:
I enter a number and the prompt closes.
I tryed doing this and got an error:
#include <iostream.h>
#include <stdlib.h>
int
main()
{
int thisisanumber;
cout<<"Please enter a number:";
cin>>thisisanumber;
cout<<"You entered: "<<thisisanumber;
system("PAUSE");
return 0;
}
Is this way off?
It doesn't look like you're using normal quotes ("")...
Cool it took me a minute to figure out what you were saying. Thanks for the help.
Actually, the prompt closing after entering the number is normal. Having a pause there is useful when debugging, but generally, you don't want a pause when a console application finishes. Try running it from a cmd console, and you'll see.
Ok I had to go dig around in console mode for a while and remeber how to navigate around in it. Heh, I kept typing ls instead of dir. Oh well what's the command to run the program? I went to the directory the file was in and typed run project 2.exe. And it said run wasn't a valid command.
Just type the name of your exe file. If it's named with a space in it, you have to surround the command with quotes. The exe extension is optional.
c:\projects\project 2\release>"project 2"
Ok that does make a lot more sense. thanks for the help.
QuoteDoes this work?
You said there's an error, so no.
http://unxutils.sf.net