0
C++ code playground not working
The C++ code playground not working. Once I press run it says compilation error. Am I the only one having this problem?
8 Answers
+ 4
error :
cout >>sum>>endl;
correct syntax:
cout <<sum<<endl;
// change >> to <<
+ 2
Post the link to your code, so we can help.
+ 1
Your streams are reversed
cout << sum << endl;
You can eadily remember this by looking at this as an arrow, data flows from your variables to the cout stream.
For cin, its opposite, from the cin stream to your vars
cin >> x;
0
Compilation error. Is there anything wrong with the c++ code?
0
no i checked everything if i put something wrong it shows what i did wrong
0
Can you show me the code?
0
heres a simple one but it doesnt work either
#include <iostream>
using namespace std;
int main() {
int a = 7;
int b = 8;
int sum = a+b;
cout >> sum >> endl;
return 0;
}
0
i just tried it and now its fine! thank you!!