0
Why this code isn't working? (C++)
Code: #include <iostream> using namespace std; int main() { int a; cout << "enter a number"; cin >> a; cout <<" " << a << endl; int b; cout << "enter anther number"; cin >> b; cout << " " << b << endl; int c=a + b; int d=a - b; int e=a * b; cout<< "The sum is "<<c, d, e; return 0; } This is is a calculator the problem is that the multiplication isn't working i dont know what Help please
8 ответов
+ 2
last cout is done wrong.
It should be cout<< "The sum is " << c << " "<< d << " " << e;
The compiler cuts everything after comma, in newer compilers it shows error.
+ 1
@R4Z7 now you see the difference between your code and @Mara's one? I will point the differences:
-Variables are initialized
-Last cout has changed to the one that I told you about.
0
What is it c++11?
0
Still she did it different you just told me to change the last line
- 1
No you did it wrong your code working but he is printing all of them not just one my code is working just the multiplication isn't it shows no error when i compiler
- 1
Ooo