My student number: s134099 大吉 ~\(^o^)/~ ----------------------------- |
上の例以外の表示については以下のようにしましょう.
中吉 \(^o^)/ 小吉 (^o^) 吉 (^_^) 末吉 (-_-) 凶 orz
/* ************************************************** */ /* */ /* プログラミング入門 情報科学演習C7 */ /* レポート課題 */ /* 2013.11.06 */ /* */ /* ************************************************** */ /* */ /* 学生番号: */ /* */ /* 氏名: */ /* */ /* ************************************************** */ /* */ /* この行以降に解答のプログラムを書くこと */ #include <stdio.h> #include <stdlib.h> #include <time.h> main() { srand((unsigned) time(NULL)); printf("My student number: s134099\n\n"); int lot = rand() % 100; if(lot<7) printf("大吉 ~\\(^o^)/~\n\n"); else if(lot<17) printf("中吉 \\(^o^)/\n\n"); else if(lot<32) printf("小吉 (^o^)\n\n"); else if(lot<65) printf("吉 (^_^)\n\n"); else if(lot<90) printf("末吉 (-_-)\n\n"); else printf("凶 orz\n\n"); printf("-----------------------------\n\n"); return(0); } |