所以我刚开始编程,我不知道为什么我的代码不起作用,错误说它有错误但我不明白。我试图在这里和 Youtube 上查找它,但我似乎无法回答。这是代码:
#include <iostream>
using namespace std;
int main ()
{
int num1, num2 ,num3 , num4, num5;
//Assigning numbers
cout << "Give me 5 positive numbers, and then I'll add them up."<<endl;
cout << "Input first number: ";
cin >> num1;
cout << "Input second number: ";
cin >> num2;
cout << "Input third number: ";
cin >> num3;
cout << "Input fourth number: ";
cin >> num4;
cout << "Input fifth number: ";
cin >> num5;
int result;
//Adding the numbers
if ((num1, num2, num3, num4, num5 = - )){
cout << "Error";
}else{
result = num1 + num2 + num3 + num4 + num5;
cout << "The sum of the five numbers are " << result << ".";
}
return 0;
}