Answer the question
In order to leave comments, you need to log in
Why is the second number jumping?
I recently started learning C++ so maybe I'm dumb but I really don't understand)
#include <iostream>
using namespase std;
int main()
{
int a, b, i;
int sum;
cout << "Zaday pervoe chislo\n";
cin >> a;
cout << Zaday znak\n";
cin i;
cout << Zaday vtoroe chislo\n"; <--перескакивает
cin >> b;
sum = a >> i >> b;
cout << "Summa :" << sum << endl;<--сюда.
return 0;
Answer the question
In order to leave comments, you need to log in
You have several errors in your code
#include <iostream>
using namespace std;
int main()
{
int a, b;
int sum;
char i;
cout << "Zaday pervoe chislo\n";
cin >> a;
cout << "Zaday znak\n";
cin >> i;
cout << "Zaday vtoroe chislo\n";
cin >> b;
if (i == '+')
sum = a + b;
if (i == '-')
sum = a - b;
if (i == '*')
sum = a * b;
if (i == '/')
sum = a / b;
cout << "Summa :" << sum << endl;
return 0;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question