Please what are some common mistakes in c++,I have already written a code but it doesn't compile and I don't know the problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please what are some common mistakes in c++,I have already written a code but it doesn't compile and I don't know the problem

c++ compilation problem

28th Apr 2019, 2:54 PM
Dulgan Danjuma
Dulgan Danjuma - avatar
4 Answers
28th Apr 2019, 3:01 PM
Anna
Anna - avatar
+ 3
cout, cin and endl are defined in the standard library. To use them, you either need to replace each cout with std::cout (same with cin and endl), or you can simply add the line "using namespace std;" after #include <iostream>
29th Apr 2019, 4:02 AM
Anna
Anna - avatar
+ 2
Here is the code #include <iostream> int main() { int a, b; int sum; cout << "Enter A Number \n"; cin >> a; cout << "Entet Another Number \n"; cin >> b; sum=a+b; cout << " Answer Is: "<< sum << endl; return 0; }
28th Apr 2019, 10:27 PM
Dulgan Danjuma
Dulgan Danjuma - avatar
+ 2
Thanks that really helped
29th Apr 2019, 11:36 AM
Dulgan Danjuma
Dulgan Danjuma - avatar