好吧,我知道这比您想要的要多,但是我从以下代码中找不到问题
#include <iostream>
using namespace std ;
int main(void)
{
int score1, score2;
PrintInfo() ;
score1 = GetScore(); // Call function GetScore, to obtain a value for score1.
if (RangeError()) ; // IF score1 is out of range, print an error message.
{
cout << "Sorry you entered an invalid score." << endl ;
}
else // THIS IS LINE 46, THIS IS THE ELSE IT IS TALKING ABOUT
{
score2 = Getscore ; // Call GetScore a second time, to obtain a value for score2.
if (RangeError ()); // IF score2 is out of range, print an error message.
{
cout << "Sorry you entered an invalid score." << endl ;
}
else // ELSE, using a call to function maximum within a cout
{ // statement, print the maximum score.
cout << maximum() << endl ;
}
}
return 0;
}
我知道那里有很多东西,但是主要问题似乎是我的第二个问题。无论出于何种原因,我都会遇到以下错误:
lab05a.cpp:46:错误:预期`}''else'
lab05a.cpp:在全局范围:
lab05a.cpp:46:错误:" else'''''''
我知道这与括号有关,但我找不到任何问题!另外:对于缺乏线路号,我深表歉意,我们没有使用允许它们的编辑器。我本可以添加它们,但是我删除了很多无关紧要的文本,以使其简洁,并将它们添加为错误的行号。因此,我将展示第46行在哪里。我删除了大多数声明,因为这个问题似乎没有在其中。请帮助我,这是我第一次遇到我无法解决的问题。
if (RangeError()) ;
{
应该是
if (RangeError())
{