Author | Message | Time |
---|---|---|
crashtestdummy | I have this: [code] #include <iostream.h> int main() { int thisisanumber; cout<<"Please enter a number:"; cin>>thisisanumber; cout<<"You entered: "<<thisisanumber; return 0; }[/code] 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: [code] #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; }[/code] Is this way off? | July 4, 2004, 2:14 AM |
Moonshine | [quote author=muert0 link=board=30;threadid=7557;start=0#msg68390 date=1088907263] I have this: [code] #include <iostream.h> int main() { int thisisanumber; cout<<"Please enter a number:"; cin>>thisisanumber; cout<<"You entered: "<<thisisanumber; return 0; }[/code] 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: [code] #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; }[/code] Is this way off? [/quote] It doesn't look like you're using normal quotes ("")... | July 4, 2004, 6:42 AM |
crashtestdummy | Cool it took me a minute to figure out what you were saying. Thanks for the help. | July 4, 2004, 7:35 AM |
Adron | 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. | July 4, 2004, 8:54 AM |
crashtestdummy | 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. | July 4, 2004, 3:11 PM |
Adron | 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" | July 4, 2004, 4:35 PM |
crashtestdummy | Ok that does make a lot more sense. thanks for the help. | July 4, 2004, 4:57 PM |
UserLoser. | [quote]Does this work?[/quote] You said there's an error, so no. | July 5, 2004, 7:45 AM |
St0rm.iD | http://unxutils.sf.net | July 5, 2004, 1:40 PM |