<分区>
我刚刚开始使用 C++,但遇到了一个错误。它告诉我我有一个没有前面的“如果”的“其他”,但我有。我检查了代码的大小写,它看起来基本上就像我正在学习的网站上的示例,它在所有 cout 之后只是有不同的句子,所以我不知道哪里出了问题。任何帮助将不胜感激。
int main()
{
int iOud;
cout<<"Type in your age: ";
cin >> iOud; //"a variable for the person's age
cin.ignore();
if (iOud < 20 );{
cout<< "A message\n";
}
else if (iOud > 40 ) {
cout << "A message\n";
}
else {
cout << "A message\n";
}
cin.get();
}