Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

Posts: 3
Joined: 2003-05-29 21:39


Post by lena2383 » 2003-05-29 21:43

Hi guys I am new to the C++ programming but I am learning it, some of it anyway. Problem when I excute my program it will automatically return back to the coding. I don't get to see my results. WHY

I thank you in advance
JB :lol:

Posts: 1
Joined: 2003-05-16 20:55

it's been a long time but ...

Post by sleepy » 2003-05-29 22:37

I think this will do it for you. You'll need to see which include has PAUSE in it.

int main()
... put this right after your results are displayed
... press a key to continue (back to your code)

Forum Moderator
Posts: 1420
Joined: 2003-04-22 14:37

Post by TheParanoidOne » 2003-05-30 03:04

Or compile it in your IDE but run it from a command line.
The world is coming to an end. Please log off.

DC++ Guide | Words

Posts: 3
Joined: 2003-05-29 21:39

Here chech this out

Post by lena2383 » 2003-05-30 11:01

here is my code and were I put the system Pause

//T3AppE02.cpp - calculates and displays the new weekly pay

#include <iostream>
using namespace std;

int main()
//declare variables
float currentPay = 0.0;
float rate = 0.0;
float raise = 0.0;
float newPay = 0.0;

//enter input items
cout << "Enter current weekly pay: ";
cin >> currentPay;
cout << "Enter raise rate: ";
cin >> rate;

//calculate raise and new pay
raise = currentPay * rate;
newPay = raise + currentPay;

//display output item
cout << "New pay: " << newPay << endl;

sysrem ("Pause");
return 0;
} //end of main function

Posts: 141
Joined: 2003-05-25 01:48
Location: USA

Post by Gratch06 » 2003-05-30 13:05

You need to include the cstdlib file at the top
#include <cstdlib>

C++ is case sensitive. The command needs to be:


- Gratch

Posts: 3
Joined: 2003-05-29 21:39


Post by lena2383 » 2003-05-30 14:14

Thanks to you all for you input it working correctly and I thanks you again


The Creator Himself
Posts: 296
Joined: 2003-01-02 17:15

Post by arnetheduck » 2003-05-30 19:43

That's not a very good way because it's system dependant. Better not to move outside C++, and do something like

Code: Select all

cout << "Press any key";
Then you don't need to include cstdlib either. system is a legacy function from the old times of C...