代码:

#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;
        }
    }
    
}

 

课堂未完成原因:没有写随机的加减乘除;

相关文章:

  • 2022-12-23
  • 2021-06-25
  • 2021-09-05
  • 2021-08-11
  • 2021-12-06
  • 2021-08-12
  • 2022-02-09
猜你喜欢
  • 2022-12-23
  • 2021-05-28
  • 2022-01-28
  • 2022-01-29
  • 2021-08-17
  • 2021-10-21
  • 2021-08-24
相关资源
相似解决方案