0
votes

I have following code:

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

int main(int argc, char *argv[])
{
    int salary;
    int childeren;
    cout << "please type base salary=";
    cin>> salary >> endl;
    cout<< "plz type count your childeren=";
    cin >> childeren >> endl ;
    int Totalsalary=salary + childeren*10;
    cout<< Totalsalary<< endl;
    return 0;
}

I'm trying to understand creating error:

no match for 'operator>>' (operand types are 'std::basic_istream::__istream_type {aka std::basic_istream}' and '') cin>> salary >> endl; ^

1
cin>> salary >> endl; omit the endl.πάντα ῥεῖ

1 Answers

5
votes

std::endl is meant for creating end of line and flushing stream buffer. It supposed to be use with std::cout not with std::cin.

So correct your following line

cin>> salary >> endl;

to

cin>> salary;