访客只能看到部份内容,免费 加入会员 或由脸书 Google 可以看到全部内容
#include<time.h> char* card (int n) { static char num[] = {0,0}; switch(n){ case 1: return "A"; case 10: return "10"; case 11: return "J"; case 12: return "Q"; case 13: return "K"; default: num[0] = n+Ɔ' } return num; } int main(void) { int me ,pc; srand(time(0)); while (1){ printf("您的牌= %s", card (me=rand()%13+1)); printf (" 电脑牌=%s\n", card (pc=rand()%13+1)); if (me>pc) printf("★You Win★╭∩╮_(︶︿︶)_╭∩╮\n"); else printf("◆You Lose◆╮(╯▽╰)╭\n"); getchar();} system("PAUSE"); return 0; }
下面是引用daviddr于2008-05-31 23:56发表的 : 这样写如何?[code]#include<time.h>char* card (int n){ static char num[] = {0,0};.......