| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 847 人关注过本帖
标题:[灌水]发个小东西
只看楼主 加入收藏
一光年
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
快速回复:[灌水]发个小东西
数据加载中...
 
   



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

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