c++ - error: no match for 'operator>>' (operand types are 'std::basic_istream<char> cin>> salary >> endl; ^ -
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 childeren="; cin >> childeren >> endl ; int totalsalary=salary + childeren*10; cout<< totalsalary<< endl; return 0; } i'm trying understand creating error:
no match 'operator>>' (operand types 'std::basic_istream::__istream_type {aka std::basic_istream}' , '') cin>> salary >> endl; ^
std::endl meant creating end of line , flushing stream buffer. supposed use std::cout not std::cin.
so correct following line
cin>> salary >> endl; to
cin>> salary;
Comments
Post a Comment