代码:
#include<iostream> #define N 30 using namespace std; void main() { cout<<"****************************************"<<endl; cout<<endl; cout<<" 四则运算 "<<endl; cout<<endl; cout<<"****************************************"<<endl; double a[N],b[N]; int i,j; for(i=0;i<N;i++) { a[i]=rand()%99;b[i]=rand()%99; j=rand()%5; if(j==1) { cout<<a[i]<<"+"<<b[i]<<"="<<endl; } if(j==2) { cout<<a[i]<<"-"<<b[i]<<"="<<endl; } if(j==3) { cout<<a[i]<<"*"<<b[i]<<"="<<endl; } if(j==4) { cout<<a[i]<<"/"<<b[i]<<"="<<endl; } } }
课堂未完成原因:没有写随机的加减乘除;