#include <stdio.h>
#include <stdlib.h>

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

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

srand(time(NULL));
int a = rand()%9+1;


//switch case,如果不加上break,程式會一直往下執行
switch(a){
case 1:
printf("頭獎!");
break;
case 2:
printf("二獎!");
break;
case 3:
printf("三獎!");
break;
//除了頭獎、二獎、三獎以外
default:
printf("銘謝惠顧");
break;
}

return 0;
}

文章標籤
全站熱搜
創作者介紹
創作者 kenohya 的頭像
kenohya

One Note with Two Memories

kenohya 發表在 痞客邦 留言(0) 人氣(361)