0

As a beginner, I tried to build an arithmetic operations on cpp but it's showing me an error, please help me debug

https://code.sololearn.com/cII8tlWUF4wn/?ref=app

27th May 2019, 1:18 PM
Usman Muhammad Usman Biriri
Usman Muhammad Usman Biriri - avatar
3 ответов
+ 3
Problem 1: You used a speacial character for a, and that doesn't work Problem 2: You got multiple input like this: cin >> a, b; instead if: cin >> a >> b; Problem 3: You used 2 single quotes (' ') instead if 1 double quote (") After that, there were only visual problems: There are no line breaks, which makes it impossible to read (use endl), and between the variable name and text you didnt use a whitespace -> "the sum if the numbers is3" instead of "the sum of the numbers is 3" Some tips: 1. You don't need to make other variables to it, you could use: cout << "The sum of the true values is: " << a + b << endl; 2. You should use whitespaces to make the code more readable, so instead of: cout<<"the sum of the two values is"<<c; use: cout << "the sum of the two values is" << c; https://code.sololearn.com/ctc9meeB4mep/?ref=app
27th May 2019, 1:29 PM
Airree
Airree - avatar
+ 1
i dont know how to write c++ code but it work like this, you where using single quote twice instead of a double quote once in cout, and i dont know how cin works, but i separate it to work though #include <iostream> using namespace std; int main() { int a,b,c,d,e,f; cout<<"enter the value of a and b"; cin >>a; cin >> b; c=a+b; d=a*b; e=a/b; f=a-b; cout<<"the sum of the two values is " <<c; cout<<"\nthe product of the two values is " <<d; cout<<"\nthe divident of the two values is " <<e; cout<<"\nthe difference of the two values is " <<f; return 0; }
27th May 2019, 1:24 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 1
Btw tags are keywords which helps the people who wanna help to actually help you , in this case tags would be C++ , arithmetic , error Ex if someone searches C++ your question will popup ;)
27th May 2019, 1:56 PM
Shahil Ahmed
Shahil Ahmed - avatar