当前位置: 代码迷 >> C语言 >> [灌水]发个小东西
  详细解决方案

[灌水]发个小东西

热度:430   发布时间:2004-11-24 18:03:00.0
[灌水]发个小东西

今天无聊,想想自己还从还没在这发过主题,所以乱写了一个小东西

呵呵 是个猜数赌博的小游戏

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

int main(void) { int c,d,a; int money=10; printf("Welcome to play Guess-Guess!\n"); printf("Now you have 1 yuan.^_^\nMoney=1 yuan\n"); do { randomize(); c=random(10); printf("Please input the number you guess(From 0-9): "); scanf("%d",&d); printf("The random number is %d .\n",c); if(c==d) {money=money+1; printf("Congatulates!^_^\n"); printf("Now you have %d yuan.",money); printf("Try again? Please choose 0 or 1.(0-No; 1-Yes)\n"); scanf("%d",&a); if(a==1) printf("You choose Yes and the game will go on^_^.\n"); else printf("Bye-Bye!"); } else {money=money-1; printf("Sorry,YOU LOSE.\n"); if(money==0) {printf("Now you have no money.@_@\nGame over! Bye!"); a=0;

} else {printf("Now you still have %d yuan. Go on? ",money); printf("Please choose 0 or 1.(0-No; 1-Yes)\n"); scanf("%d",&a); if(a==1) printf("You choose Yes and the game will go on^_^.\n"); else printf("Bye-Bye!"); } }

printf("\n\n"); }while(a==1);

getch(); return 0; }

搜索更多相关的解决方案: 小东西  灌水  

----------------解决方案--------------------------------------------------------
  相关解决方案