标题:[灌水]发个小东西
只看楼主
一光年
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2004-9-3
 问题点数:0 回复次数: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; }

搜索更多相关主题的帖子: 小东西 灌水 
2004-11-24 18:03



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-8347-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.208492 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved