??????????? ??????????????????????????
???????????? ???????[ 2015/4/17 10:58:29 ] ???????????????? ???? ???????
?????????????
??????д????ж???????????????????????????????????????????????????????
????????????????
#include "stdafx.h"
#include "stdlib.h" //???????????????
#include "iostream.h"
#include "time.h"
int wrong=0??right=0;
void Addjudge(int k1??int k2)
{
int k3;
cout<<"????"<<k1<<"+"<<k2<<"=";
cin>>k3;
if(k1+k2!=k3)
{
cout<<"??????"<<endl;
wrong++;
}
else
{
cout<<"??????"<<endl;
right++;
}
}//?ж?????????????
void Subjudge(int k1??int k2)
{
int k3;
cout<<"????"<<k1<<"-"<<k2<<"=";
cin>>k3;
if(k1-k2!=k3)
{
cout<<"??????"<<endl;
wrong++;
}
else
{
cout<<"??????"<<endl;
right++;
}
}//?ж??????????????
void Chengjudge(int k1??int k2)
{
int k3;
cout<<"????"<<k1<<"*"<<k2<<"=";
cin>>k3;
if(k1*k2!=k3)
{
cout<<"??????"<<endl;
wrong++;
}
else
{
cout<<"??????"<<endl;
right++;
}
}//?ж?????????????
void Chujudge(int k1??int k2)
{
int k3;
cout<<"????"<<k1<<"/"<<k2<<"=";
cin>>k3;
if(k1/k2!=k3)
{
cout<<"??????"<<endl;
wrong++;
}
else
{
cout<<"??????"<<endl;
right++;
}
}//?ж??????????????
int main(int argc?? char* argv[])
{
int a[6]??ch; //??????????飬????????????
int temp;
srand((unsigned)time(NULL)); //???????????????β????
int k1??k2; //k1??k2????????????????n?????
cout<<"??????????????"<<endl;
cin>>a[0];
if(a[0]<0)
{
cout<<"???????????????"<<endl;
cin>>a[0];
}
//??????????a[0]
cout<<"??????????г??(??->1; ??->0)??"<<endl;
cin>>a[1];
while(a[1]<0||a[1]>1)
{
cout<<"???????????????????(0~1)??";
cin>>a[1];
}
//?????????a[1]
cout<<"????????????Χ??";
cin>>a[2];
//?????????Χa[2]
cout<<"???????????????(??->1; ??->0):"<<endl;
cin>>a[3];
while(a[3]<0||a[3]>1)
{
cout<<"???????????????????(0~1)??";
cin>>a[3];
}
//????????з???a[3]
cout<<"????????????и???(??->1; ??->0)??"<<endl;
cin>>a[4];
while(a[4]<0||a[4]>1)
{
cout<<"???????????????????(0~1)??";
cin>>a[4];
}
//??????????????a[4]
cout<<"???????У?"<<endl;
cin>>a[5];
if(a[5]<0)
{
cout<<"???????????????"<<endl;
cin>>a[5];
}
//??????a[5]
for(int i=1;i<=a[0];i++) //???????????????????a[0]
{
if(a[3]==0){
k1=rand()%(a[2]); //???????a[2]?????????a[2]?????????????????Χ
k2=rand()%(a[2]);
if(a[4]==0) //????????и??????????????????????????????
{
if(k1<k2)
{
temp=k1;
k1=k2;
k2=temp;
}
}
else
{
k1=rand()%(a[2]);
k2=rand()%(a[2]);
}
if(a[1]==1){ //a[1]???????????
ch=rand()%4; //ch?????????????????
}
else
ch=rand()%2; //ch??????????????????г??
if((i+1)%a[5]==0) //a[5]????????????????????????????????????????λ??
{
cout<<endl;
}
switch(ch)
{
case 0:
Addjudge(k1??k2);
break;
case 1:
Subjudge(k1??k2);
break;
case 2:
Chengjudge(k1??k2);
break;
case 3:
Chujudge(k1??k2);
break;
}
}
else
{
int n1??n2??n3??n4;
n1=rand()%20; //???????20???????
n2=rand()%20;
n3=rand()%20;
n4=rand()%20;
if(a[1]==1){
ch=rand()%4;
}
else
ch=rand()%2; //?????????????????
if((i+1)%a[5]==0)
{
cout<<endl;
}
switch(ch) //???????
{
case 0:
cout<<"("<<n1<<"/"<<n2<<")+("<<n3<<"/"<<n4<<")="<<" ";
break;
case 1:
cout<<"("<<n1<<"/"<<n2<<")-("<<n3<<"/"<<n4<<")="<<" ";
break;
case 2:
cout<<"("<<n1<<"/"<<n2<<")*("<<n3<<"/"<<n4<<")="<<" ";
break;
case 3:
cout<<"("<<n1<<"/"<<n2<<")/("<<n3<<"/"<<n4<<")="<<" ";
break;
}
}
}
cout<<"????????"<<a[0]<<"???????"<<right<<"?????????"<<wrong<<"??"<<endl;
cout<<endl;
return 0;
}
?????????????
?????????????
????1.????????????????????????????????????????????????????????Χ??????????
????2.???????????ú??????????????????3???д???????д????????????У???????鯔???????????????????ú??????á?
????3.?????????????????????????????????????????ж????????????????????????????е????????????????????????????????е???????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11