Chinaunix首页 | 论坛 | 博客
  • 博客访问: 592114
  • 博文数量: 149
  • 博客积分: 7191
  • 博客等级: 少将
  • 技术积分: 1561
  • 用 户 组: 普通用户
  • 注册时间: 2005-12-19 14:15
文章分类

全部博文(149)

文章存档

2013年(1)

2011年(2)

2010年(14)

2009年(29)

2008年(26)

2007年(31)

2006年(32)

2005年(14)

分类: C/C++

2007-03-21 17:03:10

/*
* This source file is written by Zhang Hao.
* This file is programmed in VC++ 6.0.
* This is a game that let user to guess an integer between 1 and 100.
* Best wishes for everyone.
*/

#include "stdafx.h"
#include
#include
#include
#include

int main(int argc, char* argv[])
{
 int index ,temp, qq;
 // Initialize the random system.
 temp=unsigned(time(NULL));
 srand(temp) ;
 index = 100*rand()/RAND_MAX;
 index = 100*rand()/RAND_MAX;
 cout< for(int i=1;i<11;i++)
 {
  cout<<"This is your "<  cin>>qq;
  if(qq==index)
  {
   cout<<"You succeed!"<   break;
  }
  else if(qq>index)
   cout<<"Your number inputed is larger!"<  else
   cout<<"Your number inputed is smaller!"< }
 cin>>qq;
 return 0;
}

 

阅读(1139) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~