此處EOF 不應使用 (!cin.eof())
正確:
int h,m,s;
while (cin>>h>>m>>s){
if (h*s<m){
cout<<h<<" "<<m<<" "<<s<<". I will be late!"<<endl;}
else{
cout<<h<<" "<<m<<" "<<s<<". I will make it!"<<endl;}
}
錯誤:
while (!cin.eof()){
int h,m,s;
cin>>h>>m>>s;
if (h*s<m){
cout<<h<<" "<<m<<" "<<s<<". I will be late!"<<endl;}
else{
cout<<h<<" "<<m<<" "<<s<<". I will make it!"<<endl;}
}