您共輸出 0 行。\
#include <iostream>
using namespace std;
int main()
{
int num1,num2;
cin>>num1;
num1=num1-1912;
num2=num1%12;
if(num2==0){
cout<<"鼠"<<endl;
return 0;
}
if(num2==1){
cout<<"牛"<<endl;
return 0;
}
if(num2==2){
cout<<"虎"<<endl;
return 0;
}
if(num2==3){
cout<<"兔"<<endl;
return 0;
}
if(num2==4){
cout<<"龍"<<endl;
return 0;
}
if(num2==5){
cout<<"蛇"<<endl;
return 0;
}
if(num2==6){
cout<<"馬"<<endl;
return 0;
}
if(num2==7){
cout<<"羊"<<endl;
return 0;
}
if(num2==8){
cout<<"猴"<<endl;
return 0;
}
if(num2==9){
cout<<"雞"<<endl;
return 0;
}
if(num2==10){
cout<<"狗"<<endl;
return 0;
}
if(num2==11){
cout<<"豬"<<endl;
return 0;
}
return 0;
}
您共輸出 0 行。\
#include
using namespace std;
int main()
{
int num1,num2;
while(cin>>num1){
num1=num1-1912;
num2=num1%12;
if(num2==0){
cout<<"鼠"<<endl;
return 0;
}
if(num2==1){
cout<<"牛"<<endl;
return 0;
}
if(num2==2){
cout<<"虎"<<endl;
return 0;
}
if(num2==3){
cout<<"兔"<<endl;
return 0;
}
if(num2==4){
cout<<"龍"<<endl;
return 0;
}
if(num2==5){
cout<<"蛇"<<endl;
return 0;
}
if(num2==6){
cout<<"馬"<<endl;
return 0;
}
if(num2==7){
cout<<"羊"<<endl;
return 0;
}
if(num2==8){
cout<<"猴"<<endl;
return 0;
}
if(num2==9){
cout<<"雞"<<endl;
return 0;
}
if(num2==10){
cout<<"狗"<<endl;
return 0;
}
if(num2==11){
cout<<"豬"<<endl;
return 0;
}
return 0;
}
}