why is it that <conio.h> doesn't work sometimes and using namespace std work in c++ -
i trying code @ hackerrank isn't working.
#include<iostream> using namespace std; int add(int b, int c) { return b+c; } int main() { int a,b,c,i,sum; cin>>a; for(i=1;i<=a;i++) { std::cin>>b>>" ">>c; sum=add(b,c); cout<<sum<<"\n"; } return 0; }
error:
error : !cannot bind 'std::basic_istream::__istream_type {aka std::basic_istream}' lvalue 'std::basic_istream&&'
you cannot this
std::cin >> b >> " " >> c;
you trying input value b
, c
fine, makes no sense
std::cin >> " "
that line should be
std::cin >> b >> c;
Comments
Post a Comment