#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;
#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;
}
你已經很接近答案了,再試試看吧!