它給了我一個錯誤,說不是所有的控制路徑返回一個值:請幫助。控制路徑不返回值3
int using_range()
{
int Num;
try{
cout << "Please enter a integer between 1 and 10: ";
cin >> Num;
if ((Num > 10) || (Num < 0)){
throw 77;
}
else if ((Num <= 10) || (Num >= 0)){
cout << Num << " is in range\n";
return 0;
system("pause");
}
}
catch (int x){
cout << "The number cannot be greater than 10, or less than zero. Error " << x << endl;
system("pause");
return 0;
}
}
林不知道該怎麼辦
只是改變你的'其他if'爲'else' – ryrich