无聊之中写的一个小游戏

作者 : Yullin 发布时间 : May 8, 2008 分类 :

#include<iostream.h>
#include<stdlib.h>
void main()
{
 int b;
 int a=rand()%100;
 do
 {
  cout<<"请猜一个1~100之间的数:"<<endl;
  cin>>b;
  if(b>a)
  {cout<<"大了,再来"<<endl;}
  else if(b<a)
  {cout<<"小了,再来"<<endl;}
  else
  {
   cout<<"恭喜你,答对了!!"<<endl;
            a=rand()%100;
  }

 }
 while(1);
}

标签: 游戏, 代码, Ubuntu Linux



上一篇:奥运火炬中国传递路线及时间表
下一篇:《一代宗师叶问》探班照曝光 甄子丹展怀旧风情

已有 5 条评论 »

  1. baljeans 1. baljeans May 9th, 2008 at 06:59 am

    一学期的C++都被我翘掉了 这个好 像是C++ 是吗?

  2. Sn.LUF 2. Sn.LUF May 9th, 2008 at 11:14 am

    [quote=baljeans]一学期的C++都被我翘掉了 这个好 像是C++ 是吗?[/quote]
    呵呵,是的。

  3. tangbuhu 3. tangbuhu May 9th, 2008 at 05:06 pm

    Hi,your link already add!

  4. xJin 4. xJin May 11th, 2008 at 02:48 am

    我也会写哦!只不过用C写,其实C和PHP很像的哦!

  5. Sn.LUF 5. Sn.LUF May 11th, 2008 at 07:40 pm

    我们直接学的c++,都没学过c的

添加新评论 »

You must enable javascript to see captcha here!