$
它应该从 5 个数字中打印所有大于 80 的数字。但是我写的程序只打印第一个大于 80 的数字。我怎样才能让它打印所有大于 80 的数字?这是我的代码..
int main ()
{
int num1,num2,num3,num4,num5;
cout << "Enter five marks : ";
cin >> num1 >> num2 >> num3 >> num4 >> num5;
cout << endl;
cout << "Marks are greater than 80 is : ";
{
if (num1 > 80)
cout << num1 << endl;
else if(num2 > 80)
cout << num2 << endl;
else if(num3 > 80)
cout << num3 << endl;
else if(num4 > 80)
cout << num4 << endl;
else if(num5 > 80)
cout << num5 << endl;
else
cout << "error" << endl;
}