a003兩光法師占卜術

#include <iostream>

using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {

int S,M,D;


while(cin>>M>>D){     
S=(M*2+D)%3;           

if(S==0)
cout<<"普通"<<endl;

if(S==1)cout<<"吉"<<endl;

if(S==2)cout<<"大吉"<<endl;

}

return 0;
}

使用相當簡單的思維
while迴圈是因應高中生程式解題系統的要求

不過在測試輸出值的時候碰上了一點問題
中文似乎都會顯示成亂碼
使用"123"測試則正常顯示
看來目前得先處理這個問題了


留言

熱門文章