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

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -