I've been trying to fix this error for a while now, I could really use some help.

C:\Users\Clayton\Documents\CH4P11.CPP(71) : error C2676: binary '>>' : 'class std::basic_ostream<char,struct std::char_traits<char> >' does not define this operator or a conversion to a type acceptable to the predefined operator

code:

#include <iostream>
#include <iomanip>
using namespace std; 


int main()
{

    double baseSalary;
    double noOfServiceYears;
    double bonus; 
    double totalSale;
    double additionalBonus;
    double payCheck;


    cout<<fixed<<showpoint;
    cout<<setprecision(2);

    cout<<"To calculate the salesperson's paycheck, please enter all data"
        <<" as accurately as possible."<<endl;


    cout<<"Please enter the base salary."<<endl;
    cin>>baseSalary;

    cout<<"Please enter the number of years that the salesperson has been"
        <<" with the company."<<endl;
    cin>>noOfServiceYears;

    if(noOfServiceYears <= 5)

        bonus = 10 * noOfServiceYears;

    else

        bonus = 20 * noOfServiceYears;



    cout<<"Finally, please enter the total sale made by the salesperson"
        <<" for the month."<<endl;
    cin>>totalSale;

    if(totalSale < 5000)

        additionalBonus = 0;

    else

        if(totalSale >= 5000 && totalSale < 10000)

        additionalBonus = totalSale * (0.03);


    else

        additionalBonus = totalSale * (0.06);


    payCheck = baseSalary + bonus + additionalBonus;

    cout<<"The paycheck for the salesperson will be approximately ">>payCheck>>" "
        <<" . Thank you for using this program."<<endl;

return 0;
}

Edited 3 Years Ago by Nick Evan: Fixed formatting

Whenever you get errors, it is typically a good idea go to the line with the error on it. On line 63 you have:

cout<<"The paycheck for the salesperson will be approximately ">>payCheck>>" "

The error message says it has a problem with '>>' on that line. Perhaps you meant to use some other operator? ;)

Hope this helps.

you know what? i feel really stupid now that i compared it to some other code. i needed <<payCheck<< not >>payCheck>>. i could have sworn >> was the right one to use, i guess i had cin>> on the mind. thanks!

I've done that so many times it is just obnoxious now.

Part of my first compilation process is just going through and fixing all the stupid typos I've made.

This article has been dead for over six months. Start a new discussion instead.