syntax error

here is my code
#include <iostream>
using namespace std;

const double SUMMER_JOB_INCOME = 0.14;
const double CLOTHES_OTHER_ACCESSORIES = 0.10;
const double SCHOOL_SUPPLIES = 0.01;
const double SAVING_BONDS = 0.25

int main()
{
double rate;
double hours;
double wages;
double wagesatax;
double clothes;
double school;
double bonds;

system("cls");
wages = rate * hours;

wagesatax = SUMMER_JOB_INCOME * wages;

clothes = CLOTHES_OTHER_ACCESSORIES * (wages - wagesatax);

school = SCHOOL_SUPPLIES * (wages-(wagesatax + clothes));

bonds = SAVING_BONDS * (wages-(wagesatax + clothes + school));

cout << "Enter the pay rate for an hour: ";
cin >> rate;
cout << endl;

cout << "Enter number of hours worked each week: ";
cin >> hours;
cout << endl;

cout << "The wages are:" << wages << endl;

cout << "Total wages before taxes:" << wages << endl;

cout << "Total wages after taxes:" << wagesatax << endl;

cout << "Total money spend on clothes and other accessories :" << clothes << endl;

cout << "Total money spend on school supplies :" << school << endl;

cout << "Total money spend on saving bonds :" << bonds << endl;

return 0;
}

this is the error i get
1>------ Build started: Project: Homework 4, Configuration: Debug Win32 ------
1>Build started 10/21/2011 11:29:31 AM.
1>InitializeBuildStatus:
1> Touching "Debug\Homework 4.unsuccessfulbuild".
1>ClCompile:
1> Excercise 20.cpp
1>c:\users\public\documents\c++\homework 4\homework 4\excercise 20.cpp(15): error C2144: syntax error : 'int' should be preceded by ';'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.26
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

You forgot to type ";" after "const double SAVING_BONDS = 0.25".
Now I get these
1>c:\users\public\documents\c++\homework 4\homework 4\excercise 20.cpp(26): warning C4700: uninitialized local variable 'rate' used
1>c:\users\public\documents\c++\homework 4\homework 4\excercise 20.cpp(26): warning C4700: uninitialized local variable 'hours' used
1>LinkEmbedManifest:
You should specify value of rate (and of hours). Just put the following code
1
2
3
4
5
6
7
cout << "Enter the pay rate for an hour: ";
cin >> rate;
cout << endl;

cout << "Enter number of hours worked each week: ";
cin >> hours;
cout << endl;

before first usage
wages = rate * hours;
But isnt that what I have on my code?
No, you have this after wages = rate * hours;
The order of statements is important in C++
Consider each statement in C++ as the axis of time. You cannot solve equations symbolically as done in mathematics.
Last edited on
Topic archived. No new replies allowed.