两位数的四则运算

#include "运算.h"
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
运算::运算()
{
}


运算::~运算()
{
}
int main()
{
    int a, b,d,i;
    cout << "请输入需要的两位数四则运算的个数" << endl;
    cin >> i;
    d = 0;
    for (int k = 0; k < i;k++)
    {
        a = rand() % (100 - 10) + 10;
        b = rand() % (100 - 10) + 10;
        int c;
        
        c = rand() % (5 - 1) ;
        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;
        }
        d = d++;
        if (d%10==0)
        {
            cout << endl;
        }
    }
    
    system("pause");
}

posted @ 2018-09-29 11:33  冰-焰  阅读(341)  评论(0)    收藏  举报