PRoblem with cin/cout and unused variables

Im trying to make a code that outputs someones earnings after various deductions. As of right now im getting an error on the constants saying that the variables are unused and that the cin or cout does not have a name type. I've tried moving various things around that looks like it fixes it but it often just leads to another error. Any thoughts on what i can do to fix it?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

#include <iostream>
#include <string>

using namespace std;

int main() {

const double TaxRate = .14;
const double Clothing = .20;
const double SchoolSupplies = .05;
const double Savings = .25;
const double wage = 15.5;

double Gross;
double Taxes; 
double Net;
double cloths;
double School;
double remain;
double savingsLeft;
double spend;
double hours1;
double hours2;
double hours3;
double hours4;
double hours5;
string initials;

cout << "Enter your initials: ";
cin >> initials;
cout << "Enter number of hours worked; ";
cin >> (hours1 + hours2 + hours3 + hours4 + hours5);

(hours1+ hours2 + hours3 + hours4 + hours5) * wage = Gross
Gross * TaxRate = Taxes
Gross - Taxes = Net
Net * Clothing = cloths
Net * SchoolSupplies = School
Net - cloths - School = remain
remain * Savings = savingsLeft
remain - savingsLeft = spend

cout << Gross;
cout << Taxes;
cout << Net;
cout << cloths;
cout << School;
cout << remain;
cout << savingsLeft;
cout << spend;
}
cin >> (hours1 + hours2 + hours3 + hours4 + hours5);

This isn't how you enter in multiple variables.

cin >> hours1 >>hours2 >> hours3 >>hours4 >>hours5;


As for the other errors the variable you are assigning to needs to be on the left side. Don't forget all of the semicolons.

1
2
3
Gross = (hours1+ hours2 + hours3 + hours4 + hours5) * wage;
Taxes = Gross * TaxRate;
//etc 
Thanks i got the program working!
Topic archived. No new replies allowed.