XIAO XUESHENG SHUXUECESHI
2008-10-26 21:32
239 查看
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main(void)
{enum ti {jia,jian,cheng};
int i,j,a,b,c,num=0,ge,ans;
cout<<"xuanzhe ti and geshu:"<<endl;
cin>>j>>ge;
for(i=0;i<ge;i++)
{a=rand();
b=rand();
cout<<a<<"and"<<b<<endl;
if(j==jia)
{c=a+b;
cout<<"answer is:";
cin>>ans;
if(ans==c)
num++;
else cout<<c<<endl;
}
if(j==jian)
{c=a-b;
cout<<"answer is:";
cin>>ans;
if(ans==c)
num++;
else cout<<c<<endl;
}
if(j==cheng)
{c=a*b;
cout<<"answer is:";
cin>>ans;
if(ans==c)
num++;
else cout<<c<<endl;
}
}
cout<<num;
system("pause");
}
#include <stdlib.h>
#include <time.h>
using namespace std;
int main(void)
{enum ti {jia,jian,cheng};
int i,j,a,b,c,num=0,ge,ans;
cout<<"xuanzhe ti and geshu:"<<endl;
cin>>j>>ge;
for(i=0;i<ge;i++)
{a=rand();
b=rand();
cout<<a<<"and"<<b<<endl;
if(j==jia)
{c=a+b;
cout<<"answer is:";
cin>>ans;
if(ans==c)
num++;
else cout<<c<<endl;
}
if(j==jian)
{c=a-b;
cout<<"answer is:";
cin>>ans;
if(ans==c)
num++;
else cout<<c<<endl;
}
if(j==cheng)
{c=a*b;
cout<<"answer is:";
cin>>ans;
if(ans==c)
num++;
else cout<<c<<endl;
}
}
cout<<num;
system("pause");
}
相关文章推荐
- ceshi
- ceshi
- [转thyking xiao's blog]asp.net 2.0实现多语言(一)
- ceshi
- ceshi
- 杂谈(12)分享xiaobenny的活动策划及总结 推荐
- java读取地址栏参数(id=123&name=xiaoxiao)
- 1011_Xiao_Ming's_Hope
- 转载TortoiseSVN的使用详解1(http://www.cnblogs.com/xiaobaihome/archive/2012/03/20/2407610.html)
- 云诺网盘注册领取一键工具 By xiaoH
- Hoj 2665 Factory of XiaoE
- The trouble of Xiaoqian
- http://xiaobude.com/app/douban/
- ceshi
- HDU 3591 The trouble of Xiaoqian(多重背包+完全背包)
- Nani_xiao的机器学习与总结:Andrew Ng.机器学习(四) :牛顿方法
- The trouble of Xiaoqian
- hdu 5433 Xiao Ming climbing(bfs+三维标记)
- dp hdu5433 Xiao Ming climbing
- hdu 5433 Xiao Ming climbing bfs