猜数字
来源:互联网 发布:点点客工作 知乎 编辑:程序博客网 时间:2024/06/06 04:15
/*
*Copyright(c)2016,LynseyListening
*All rights reserced.
*文件名称:listening.cpp
*作者 :陈旭
*完成日期:2016.3.24
*版本号 :vc++6.0
*/
#include<iostream>
#include<ctime>
using namespace std;
int main()
{
int x;
int a;
srand(time(NULL));
a=rand()%1000;
while(1)
{
cout<<"请输入您猜的数:"<<endl;
cin>>x;
if(x>a)
cout<<"大了"<<endl;
else if(x<a)
cout<<"小了"<<endl;
else
{
cout<<"猜对了"<<endl;
break;
}
}
return 0;
}
运行结果:
0 0
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- 猜数字
- Java内存模型FAQ(三)JSR133是什么?
- clang: error: no such file or directory: "xxxxxx" clang: error: no input files
- poj-3122-Pie
- sql教师表存储过程
- Linux网络命令-netstat、route、nslookup...
- 猜数字
- 通用的ListViewAdapter
- 第四周项目3-猜数字游戏
- C++实验2-标准体重
- c++实验2——标准体重
- C++实验2-1-标准体重
- windows下架设SVN服务器并设置开机启动
- eclipse安装tomcat报错:The Tomcat installation directory is not valid. It is missing expected file or fol
- [转]Ext Grid控件的配置与方法