Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / nooby c++ question

Author
Message
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 20th Jun 2009 01:46
ok, i have Microsoft's Visual C++ compiler and im learning the basics for C++, but im unsure of how to compile exactly

when i run the program it flashes a black command box for a second that I think is my program but it disappears too quick for me to read it, what am I doing wrong?

There are only 10 kinds of people in the world, those who understand binary and those who dont
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 20th Jun 2009 02:12
Try putting "system("pause");" at the end of main()

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 20th Jun 2009 02:14
ok with or without the quotes?

ordinarily that would be a stupid question but since you've got 2 sets of quotes there it confuses me

There are only 10 kinds of people in the world, those who understand binary and those who dont
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 20th Jun 2009 02:18 Edited at: 20th Jun 2009 02:18
Sorry, without the quotes around the line.

Just this:


Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 20th Jun 2009 02:19
ok do i need any special #include libraries for that?

There are only 10 kinds of people in the world, those who understand binary and those who dont
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 20th Jun 2009 02:55
I don't think so. Did you try it yet?

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 20th Jun 2009 02:59
no, im not at home im at work, ill try it l8r and get back to you

There are only 10 kinds of people in the world, those who understand binary and those who dont
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 20th Jun 2009 04:39
ok it worked, tnx!

There are only 10 kinds of people in the world, those who understand binary and those who dont
n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 20th Jun 2009 20:45
Note: system(); sends a message to the command prompt window your program is working in. So you could use system("calc.exe"); to run calculator or system("cls"); to clear the screen, etc...

"I have faith, that I shall win the race, even though I have no legs, and am tied to a tree." ~Mark75
mikeMarek 597
15
Years of Service
User Offline
Joined: 12th Feb 2009
Location:
Posted: 20th Jun 2009 23:30
If you want to be able to run your program on other operating systems, you cannot use system("pause") since it is a Windows-specific command. I use this function:

You need to include the file <iostream> with your program (you need this anyways for placing output text into the command window) and to be using the std namespace (using namespace std;). If you want, you could place std:: infront of every cin. command in the function.

Wait... What were we talking about?

Login to post a reply

Server time is: 2024-11-25 08:49:26
Your offset time is: 2024-11-25 08:49:26