#8569: 請問哪裡錯誤?


ron19971997 (Ron Lee)

學校 : 臺北市立成功高級中學
編號 : 38724
來源 : [220.136.16.77]
最後登入時間 :
2014-09-25 10:14:34
a003. 兩光法師占卜術 | From: [114.45.47.16] | 發表日期 : 2014-01-23 20:59

#include<iostream>
using namespace std;
int main()
{
    int M,D,S;
    S=(M*2+D)%3;
    while(cin>> M>> D)
    {
    cout<<S<<endl;
    if(S==0)
    cout<<"\n普通";
    else if(S==1)
    cout<<"\n吉";
    else(S==2);
    cout<<"\n大吉";
    }
    system("pause");
    return 0;
}

 
#8573: Re:請問哪裡錯誤?


dibery (Bor)

學校 : 政治大學
編號 : 23441
來源 : [119.14.19.119]
最後登入時間 :
2016-04-07 01:20:18
a003. 兩光法師占卜術 | From: [1.171.113.155] | 發表日期 : 2014-01-26 00:43

Calculate S in the loop.

Don't print S as it's not required by the statement.

Also, don't use system( "pause" ) when submitting here.

 
ZeroJudge Forum