error C2678

Ok, I know that the error C2678 is an undefined operand. I have included <iostream> and used namespace std. Yet when I build, the very first error I get is C2678!! and it says '>>' is undefined. Help please!! LOL
Let's see the code.
// SalesCommission.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>

using namespace std;

int _tmain()
{
//declaring variables
int ID, sales, total, commission;
//chrval to close window
char chrval;
//for loop
for(int ID = 1; ID <= 3; ID++) {
cout << "Enter Salesman ID ";
cin >> "ID ";
//while loop
while(sales >= 0) {
total = sales++;
}
cout <<"Enter Sales Amount ";
cin >>"sales ";
//if else statements for commission
if(total > 5000)
commission = 400 + 20%(total - 5000);
else if(total >1000)
commission = 10%(total - 1000);
else commission = 0;
//displaying outputs
cout <<"Salesman ID " << (ID) << endl;
cout <<"Total Sales $ " << (total) << endl;
cout <<"Total Commission $ " << (commission) << endl;
}
//displaying outputs to close window
cout <<"Enter Any Value To Close The Window " ;
cin >>"chrval ";

return 0;
}
All of these shouldn't have double quotes:

1
2
3
4
5
cin >> "ID ";

cin >>"sales ";

cin >>"chrval "

Also, you're modifying ID within a for loop that uses it as the terminating condition. This could have unintended consequences.

This:

while(sales >= 0) {

produces undefined behaviour since sales is uninitialized when it reaches that loop. And, if that loop gets entered at all, it will be infinite (well not infinite. It will stop when sales overflows).
Shackar told you all you have to do.

And do not forget the cardinals of C++:

- C++ is case-sensitive language (And you have a varialbe "ID" .......);
- cin stands for console input not console output... With cin you control a variable, actually you assign it.

So yeah do not use quotes after cin...
Thanks so much for all the help!!! I greatly appreciate it!!!!
Topic archived. No new replies allowed.