0
#include <iostream>
`#include <string>
using namespace std;
int main()
{
int test1, test2, test3;
int testAverage;
testAverage = (test1 + test2 + test3)/3;
cout << "Please enter your three test scores" << endl;
cin >> test1;
cin >> test2;
cin >> test3;
cout << "Your total test average is " << testAverage << endl;//my total average displays an insanly high number here as well im unsure why
if (testAverage >= 90)
cout << "Your Grade Is an A average" << endl;
else
{
if (testAverage < 90)
{
cout << "Your test average is B" << endl;
}
else if (testAverage < 80)
{
cout << "Your test average is C" << endl;
}
else
{
if (testAverage < 70)
{
cout << "Your test average is D" << endl;
}
}
}
return 0;
}
//我不知道是否我用方括號嵌套if語句的方式對於我來說是相當新的,或者如果它是我做的其他錯誤。有人可以讓我知道爲什麼運行時錯誤正在發生,爲什麼數學會出現瘋狂,甚至幫助我清理我的代碼。作業的問題是以嵌套的if語句格式顯示三個測試分數平均值的等級。我相信問題與括號有關,但我不確定。爲什麼我在調試我的嵌套if語句程序時遇到運行時錯誤?