I hope this doesn't come across as confusing. I am doing something wrong, with a "error C2059: syntax error: ';' - line 45; error C2059: syntax error : '/' - line 47. I'm not sure, but maybe it has something to do with the %, and that I didn't use a needed header file to do this type of math. Please help me out, I am so stumped.

#include <iostream>
using namespace std;

int main()
{
double Pop;
double CF;
double RaceBonus;
double TO;
double TotalBuildings;
double Research;
double temp;
double temp2;
double temp3;
double temp4;
double income;


cout << "Enter population: ";
cin >> Pop;
cout << endl;

cout << "Enter total Cash Factories: ";
cin >> CF;
cout << endl;

cout << "Enter your Income Race Bonus: ";
cin >> RaceBonus;
cout << endl;

cout << "Enter total Tax Offices: ";
cin >> TO;
cout << endl;

cout << "Enter your total Buildings: ";
cin >> TotalBuildings;
cout << endl;

cout << "Enter your researched Economy Bonus: ";
cin >> Research;
cout << endl;

temp = 100+ (Pop /30) + (CF *8);
temp2 = 1+ RaceBonus / 100%;
temp3 = 1+ 2 * TO / TotalBuildings;
temp4 = 1+ Research% / 100%;
income = temp * temp2 * temp3 * temp4;


cout << "Your total Income is: " << income << endl;

cout << "Press <Return> to quit..." << endl;
cin.get();
cin.get();

return 0;
}

>>temp2 = 1+ RaceBonus / 100%;

what is that 100% ? The % in C++ (and C) is the mod operator, which is the remainder after division. So % doesn't make any sense there. Or is that supposed to be 100 percent?

The God has sent me to say "C++ compiler is not a pocket calculator."

commented: ROFL :P +4

please open your textbook or your help file and look at the types of operators are in c/c++ before you start typing in symbols. % is not percent in c/c++ it is an operator dealing with integer division.

commented: Please read Ancient dragon's post, 3 HOURS before you. -3

The God has sent me to say "C++ compiler is not a pocket calculator."

Then why did he package the computer with the program calc.exe? It seems he does -- if you have a pocket big enough! :icon_twisted:

% used to get remainder during division operation.

>>Then why did he package the computer with the program calc.exe
Humans packed calc.exe not god.
LoL, my mobile phone has a C++ compiler running on DosBox.

LoL, my mobile phone has a C++ compiler running on DosBox.

Jeez :icon_rolleyes:

:)

commented: Maybe he's just obsessed by C++ :P +4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.