- //
- // Copyright (c) 2014软件技术1班
- // All rights reserved.
- // 作 者:A07
- // 完成日期:2014年 10 月 11日
- // 版 本 号:v1.0
- //
- // 问题描述:创建一个程序来玩游戏
- // 输入描述:一个数,代表输入数字
- // 程序输出:对不起,你猜小了或猜大了或猜对了,代表答案
- //
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace ConsoleApplication8
{
class Program
{
static void Main(string[] args)
{
int rndnum, a;//rndnum:随机产生的数,a:输入的数
Random rnd = new Random();
rndnum = rnd.Next(1, 100);
Console.WriteLine("输入一个数");
a = Convert.ToInt32(Console.ReadLine());
if (a > rndnum) Console.WriteLine("提示“对不起,你猜大了”,");
else if (a < rndnum) Console.WriteLine("提示“对不起,你猜小了”,");
else Console.WriteLine("恭喜你,猜对了!");
Console.WriteLine("输入的数:{0}",a);
Console.Read();
猜数游戏
最新推荐文章于 2024-05-05 19:55:51 发布