#include <iostream>
using namespace std;
int num1, num2, num3, num4, num5, result, result1, result2, result3, value, cont;
//number user enters/variable
int main()
{
cout << "please enter the operation,+ for addtion,- for subtaction,* for multiplatcion,/ for division"
;cin >> value
;cout << "please enter the first number number:";
cin >> num1
;cout << "please enter the second number: ";
cin >> num2
;if(value == '+' )
;result = num1 + num2;
cout << num1 << " plus " << num2 << " is equal to: " << result << ".\n";
if(value = '-' )
;result = num1 - num2;
cout << num1 << " minus " << num2 << " is equal to: " << result << ".\n";
if(value = '*' )
;result = num1 * num2;
cout << num1 << " times " << num2 << " is equal to: " << result << ".\n";
if(value = '/' )
;result = num1 / num2;
cout << num1 << " divided by " << num2 << " is equal to: " << result << ".\n";
}
{
cout << "press 1 to enter more numbers, or press 0 to not"
cin >> cont
if(cont = 1)
cout << "please enter the operation,+ for addtion,- for subtaction,* for multiplatcion,/ for division"
cin >> value1
cout << "please enter the next number:";
cin num3
else(cont = 0)
else(value1 = +)
;result1 = result + num3;
cout << result << " plus " << num3 << " is equal to: " << result1 << ".\n";
else(value1 = -)
;result1 = result - num3
cout << result << " minus " << num3 << " is equal to: " << result1 << ".\n";
else(value1 = *)
;result1 = result * num3
cout << result << " times " << num3 << " is equal to: " << result1 << ".\n";
else(value1 = /)
;result1 = result / num3
cout << result << " divided by " << num3 << " is equal to: " << result1 << ".\n";
}
{
cout << "press 1 to enter more numbers, or press 0 to not"
cin >> cont
if(cont = 1)
cout << "please enter the operation,+ for addtion,- for subtaction,* for multiplatcion,/ for division"
cin >> value1
;cout << "please enter the next number: ";
cin >> num4
else(cont = 0)
else(value2 = +)
;result2 = result1 + num4;
cout << result1 << " plus " << num4 << " is equal to: " << result2 << ".\n";
else(value2 = -)
;result2 = result1 + num4;
cout << result << " minus " << num3 << " is equal to: " << result1 << ".\n";
else(value2 = *)
;result2 = result1 * num4
cout << result << " times " << num3 << " is equal to: " << result1 << ".\n";
else(value2 = /)
;result2 = result1 / num4
cout << result << " divided by " << num3 << " is equal to: " << result1 << ".\n";
{
cout << "press 1 to enter more numbers, or press 0 to not"
cin >> cont
if(cont = 1)
cout << "enter the operation,+ for addtion,- for subtaction,* for multiplatcion,/ for division"
cin >> value2
;cout << "please enter the next number: ";
cin >> num5
if(value3 = +)
;result3 = result2 + num5;
cout << result2 << " plus " << num5 << " is equal to: " << result3 << ".\n";
else(value3 = -)
;result3 = result2 - num5
cout << result << " minus " << num3 << " is equal to: " << result1 << ".\n";
else(value3 = *)
;result3 = result2 * num5
cout << result << " times " << num3 << " is equal to: " << result1 << ".\n";
else(value3 = /)
;result3 = result2 / num5
return 0;
错误发生在第 34 行,它显示 { 所以请帮助我!该代码用于基本计算器,如果您可以更正第 34 行,请随意使用它!我不知道是什么原因造成的,我是 C++ 编码的菜鸟,所以请帮忙!我自己研究过,找不到。