C++ Error(s) while compiling code

This is not a homework question, although it is school work. But this specific code is not due for homework.

On all the work I complete I run into the same exact problem. I have searched all over the Internet and have asked the professor with no luck so far. I am getting frustrated at this point. I want to know what I am doing wrong and how to correct it.

I am using MS Visual C++ Express Edition 2008. I am using a payroll calculator program straight out of the book, exactly as it is written minus the comments.

When I try to compile the code I get several errors. This happens with all the code I have typed from the book. I have tried using different compilers, etc.

I am missing something, probably super easy. I hope it is supereasy. I appreciate any help.

The code straight from the book.
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <iostream>
#include <iomanip>

using namespace std;

int main ()
{
	const double OT_PAY_FACTOR = 1.5;
	const double NORMAL_HOURS = 40.0;
	int employee_count,
		another_employee;
	double hours,
		rate,
		regular_pay,
		ot_pay,
		gross_pay,
		total_payroll;

	total_payroll = 0.00;
	employee_count = 0;

	cout << setprecision(2)
		<<setiosflags(ios::fixed)
		<<setiosflags(ios::showpoint);

	do
	{
		cout << endl << endl;
		cout << "Enter number of hours worked:  ";
		cin >> hours;
		cout <<"\nEnter pay rate:  ";
		cin >> rate;

		if (hours > NORMAL_HOURS)
		{regular_pay = NORMAL_HOURS * rate;
		ot_pay = (hours - NORMAL_HOURS) * OT_PAY_FACTOR * rate;
		}

		else 
		{
			regular_pay = hours * rate;
			ot_pay = 0.00;
		}

		gross_pay = regular_pay + ot_pay;
		total_payroll += gross_pay;
		++employee_count;

		cout << endl <<endl;
		cout << "REGULAR PAY OVERTIME PAY GROSS PAY";
		cout << endl <<setw(11) <<regular_pay <<setw(14) << ot_pay << setw(11) << gross_pay << endl;
		cout << "---------------------------------------------------------------------------" << endl;
		
		cout << endl << endl;
		cout << "Do you want to process another employee?" << endl;
		cout << "Enter 1 for Yes or 0 for No:  ";
		cin >> another_employee;

	}
	while (another_employee);

	cout << endl << endl;
	cout >> "Payroll for " << employee_count << "employees is " << total_payroll << endl;
	
	return 0;

}



The errors that I keep getting. Not all the build log since the max character is 9000 on the forum. However, the errors are all the same just for different lines. Errors C2784 and C2676 that is.

Compiling...
payroll.cpp
c:\users\roy shoemake\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(63) : error
C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,const std::_Smanip<_Arg> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'

c:\users\roy shoemake\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(63) : error C2676: binary '>>' : 'std::ostream' does not define this operator or a conversion to a type acceptable to the predefined operator
cout >> "Payroll for "
It's cout << "Payroll for "
cout >> "Payroll for "
It's cout << "Payroll for "


See that was something simple. I just could not see it. One thing wrong and it gave me so many errors. I have respect for programmers. It is not for everyone.

I appreciate it a lot.

Yeah. It spits out a bunch of strange 3 page long garbage on some simple errors. I usually look over my code line by line when this happens. It's usually just a typo though, such as, misspelling, or missing the key.


Yeah. It spits out a bunch of strange 3 page long garbage on some simple errors. I usually look over my code line by line when this happens. It's usually just a typo though, such as, misspelling, or missing the key.



Error messages are not garbage (although I know what you mean).
if you look at this error message, it gives the EXACT line and cause of the error.
Topic archived. No new replies allowed.