#6789: 為何過不了,請協助


macosx19961220 (eric)


#include<iostream>

#include<cstdlib>

 

using namespace std;

int main()

{

    int M , D, S;

    cout<<"please input your month and date";

    cin>>M, cin>>D;

    S=(M*2+D)%3 ;

    

    if (S==0)

        cout<<"普通";

    else if(S==1)

        cout<<"";

    else

        cout<<"大吉";

    return 0;


#6790: Re:為何過不了,請協助


passerr (20130326 0340 48)


#include

#include

 

using namespace std;

int main()

{

    int M , D, S;

    cout<<"please input your month and date";

    cin>>M, cin>>D;

    S=(M*2+D)%3 ;

    

    if (S==0)

        cout<<"普通";

    else if(S==1)

        cout<<"";

    else

        cout<<"大吉";

    return 0;


我想大概是不需要這行cout<<"please input your month and date";

因為有很多輸入,所以用while(cin>>M>>D),請參考a001: 哈囉

#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
    int M,D,S;
    //cout<<"please input your month and date";
    //cin>>M, cin>>D;
while(cin>>M>>D)
{
    S=(M*2+D)%3;
    if (S==0)
        cout<<"普通";
    else if(S==1)
        cout<<"吉";
    else
        cout<<"大吉";
}
    return 0;
}
你已經很接近答案了,再試試看吧!