标签:
两种方法,第一种方法:
#include <iostream.h>
#include <stdlib.h>
int main()
{
int a,b,c;
for(int i=0;i<30;i++)
{
a=rand()%100;//x+rand()%(y-x+1)随机生成【x,y】内的整数
b=rand()%100;
c=rand()%4;
switch (c)
{
case 1:
cout<<a<<"+"<<b<<"="<<endl;
break;
case 2:
cout<<a<<"-"<<b<<"="<<endl;
break;
case 3:
cout<<a<<"*"<<b<<"="<<endl;
break;
case 4:
cout<<a<<"/"<<b<<"="<<endl;
break;
}
}
return 0;
}
第二种方法不用脑子:
#include <iostream.h>
#include <stdlib.h>
int main()
{
cout<< "1. 3/7 × 49/9 - 4/3 "<<endl;
cout<< "2. 8/9 × 15/36 + 1/27 "<<endl;
cout<< "3. 12× 5/6 – 2/9 ×3 "<<endl;
cout<< "4. 8× 5/4 + 1/4 "<<endl;
cout<< "5. 6÷ 3/8 – 3/8 ÷6 "<<endl
<< "6. 4/7 × 5/9 + 3/7 × 5/9 "<<endl
<< "7. 5/2 -( 3/2 + 4/5 ) "<<endl
<< "8. 7/8 + ( 1/8 + 1/9 ) "<<endl
<< "9. 9 × 5/6 + 5/6 "<<endl
<< "10. 3/4 × 8/9 - 1/3 "<<endl
<< "11. 7 × 5/49 + 3/14 "<<endl
<< "12. 6 ×( 1/2 + 2/3 ) "<<endl
<< "13. 8 × 4/5 + 8 × 11/5 "<<endl
<< "14. 31 × 5/6 – 5/6 "<<endl
<< "15. 9/7 - ( 2/7 – 10/21 ) "<<endl
<< "16. 5/9 × 18 – 14 × 2/7 "<<endl
<< "17. 4/5 × 25/16 + 2/3 × 3/4 "<<endl
<< "18. 14 × 8/7 – 5/6 × 12/15 "<<endl
<< "19. 17/32 – 3/4 × 9/24 "<<endl
<< "20. 3 × 2/9 + 1/3 "<<endl
<< "21. 5/7 × 3/25 + 3/7 "<<endl
<< "22. 3/14 ×× 2/3 + 1/6 "<<endl
<< "23. 1/5 × 2/3 + 5/6 "<<endl
<< "24. 9/22 + 1/11 ÷ 1/2 "<<endl
<< "25. 5/3 × 11/5 + 4/3 "<<endl
<< "26. 45 × 2/3 + 1/3 × 15 "<<endl
<< "27. 7/19 + 12/19 × 5/6 "<<endl
<< "28. 1/4 + 3/4 ÷ 2/3 "<<endl
<< "29. 8/7 × 21/16 + 1/2 "<<endl
<< "30. 101 × 1/5 – 1/5 × 21"<<endl;
return 0;
}
标签:
原文地址:http://www.cnblogs.com/zhaixing/p/4317950.html