本文实例为大家分享了C++实现猜数字游戏的具体代码,供大家参考,具体内容如下
#include<stdio>
#include<stdlib>
#include<iostream>
#include<iomanip>
//#include<ctime>
#include<time>
using namespace std;
int main()
{
int n; //记录生成的随机数,范围1~100
int g;
int count;
char c;
srand(time(0)); //time(0))返回的是系统的时间(从1970.1.1午夜算起),单位:秒,用作随机