还有
我用的一直是C++啊^
你们写的是C啊
I服了U……
还有更正下:我自己些的代码从这没拿走任何代码……
我只是来看看有什么地方可以借鉴的,可是貌似
还没有什么我现在可以借鉴的
#include <iostream.h>
#include <time.h>
#include <stdlib.h>
double addition();
double subtract();
double multiplication();
double division();
int main()
{
int n;
cout<<"******************************"<<endl;
cout<<"
小学生四则运算练习系统
"<<endl;
cout<<"******************************"<<endl;
cout<<"
1--加法练习
"<<endl;
cout<<"
2--减法练习
"<<endl;
cout<<"
3--乘法练习
"<<endl;
cout<<"
4--除法练习
"<<endl;
cout<<"请选择(0--4):";
cin>>n;
if(n==1)
{
cout<<"加法练习";
addition();
}
else if(n==2)
{
cout<<"减法练习";
subtract();
}
else if(n==3)
{
cout<<"乘法练习";
multiplication();
}
else if(n==4)
{
cout<<"除法练习";
division();
}
else if(n==0)
{
cout<<"退出";
return 0;
}
else
{
cout<<"输入错误,请重新选择"<<endl;
return main();
}
}
double addition()
{
int a,b,s,k;
char m;
srand(time(NULL));
a=rand()%100;
b=rand()%100;
cout<<a<<"+"<<b<<"="<<endl;
s=a+b;
cout<<"请输入结果:";
cin>>k;
if(k==s)
cout<<"正确,你真聪明!";
else
{
cout<<"不正确,再想一想,你还有两次机会。"<<endl;
cin>>k;
if(k==s)
cout<<"正确,继续保持!";
else
{
cout<<"不正确,不要着急,要把握住最后一次机会喔!"<<endl;
cin>>k;
if(k==s)
cout<<"正确,加油!";
else
{
cout<<"不正确,要加强练习喔!正确答案为:"<<s<<endl;
}
}
}
cout<<"是否继续练习?(Y/N)";
cin>>m;
if(m=='n'||m=='N')
return main();
else
return addition();
}
double subtract()
{
int a,b,s,k;
char m;
srand(time(NULL));
a=rand()%100;
b=rand()%100;
cout<<a<<"-"<<b<<"="<<endl;
s=a-b;
cout<<"请输入结果:";
cin>>k;
if(k==s)
cout<<"正确,你真聪明!";
else
{
cout<<"不正确,再想一想,你还有两次机会。"<<endl;
cin>>k;
if(k==s)
cout<<"正确,继续保持!";
else
{
cout<<"不正确,不要着急,要把握住最后一次机会喔!"<<endl;
cin>>k;
if(k==s)
cout<<"正确,加油!";
else
{
cout<<"不正确,要加强练习喔!正确答案为:"<<s<<endl;
}
}
}
cout<<"是否继续练习?(Y/N)";
cin>>m;
if(m=='n'||m=='N')
return main();
else
return subtract();
}
double multiplication()
{
int a,b,s,k;
char m;
srand(time(NULL));
a=rand()%100;
b=rand()%100;
cout<<a<<"*"<<b<<"="<<endl;
s=a*b;
cout<<"请输入结果:";
cin>>k;
if(k==s)
cout<<"正确,你真聪明!";
else
{
cout<<"不正确,再想一想,你还有两次机会。"<<endl;
cin>>k;
if(k==s)
cout<<"正确,继续保持!";
else
{
cout<<"不正确,不要着急,要把握住最后一次机会喔!"<<endl;
cin>>k;
if(k==s)
cout<<"正确,加油!";
else
{
cout<<"不正确,要加强练习喔!正确答案为:"<<s<<endl;
}
}
}
cout<<"是否继续练习?(Y/N)";
cin>>m;
if(m=='n'||m=='N')
return main();
else
return multiplication();
}
double division()
{
double a,b,s,k;
char m;
srand(time(NULL));
a=rand()%100;
b=rand()%100;
cout<<a<<"/"<<b<<"="<<endl;
s=a/b;
cout<<"请输入结果:";
cin>>k;
if(k==s)
cout<<"正确,你真聪明!";
else
{
cout<<"不正确,再想一想,你还有两次机会。"<<endl;
cin>>k;
if(k==s)
cout<<"正确,继续保持!";
else
{
cout<<"不正确,不要着急,要把握住最后一次机会喔!"<<endl;
cin>>k;
if(k==s)
cout<<"正确,加油!";
else
{
cout<<"不正确,要加强练习喔!正确答案为:"<<int((s+0.005)*100)/100.00<<endl;
}
}
}
cout<<"是否继续练习?(Y/N)";
cin>>m;
if(m=='n'||m=='N')
return main();
else
return division();
}
你们自己看看吧
什么不是拿你们的代码