以下是三位数的猜数游戏代码:
#include <bits/stdc++.h>
#include <windows.h>
#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include <conio.h>
#include <time.h>
#include <ctime>
using namespace std;
int main()
{
srand (time(0));
time_t t1;
int n1,n2,n3,n4;
int a1,a2,a3,a4;
int a,s1,s2;
cout <<"一个各位数不同的三位数 N ,看你用多久才能猜中。\n\n";
cout <<" ";
system ("pause");
system ("cls");
cout <<"一个各位数不同的三位数 N ,看你用多久才能猜中。\n\n";
time(&t1);
t1=t1+1;
n1=rand()%9+1;
do
n2=rand()%10;
while (n1==n2);
do
n3=rand()%10;
while (n1==n3 || n2==n3);
while (1)
{
s1=0;s2=0;
cin &