四则运算随机题30道代码

 

#include<iostream>
using namespace std;
int main(){
    int a, b, c, i;
    for (i = 0; i<30; i++){
        a = rand() %100 ;
        b = rand() %100;
        c = rand() % 4;
        if (c == 0)
            cout << a << "+" << b << "=" << endl;
        else if (c == 1)
            cout << a << "-" << b << "=" << endl;
        else if (c == 2)
            cout << a << "*" << b << "=" << endl;
        else if (c == 3)
            cout << a << "/" << b << "=" << endl;
    }
    return 0;
}

posted @ 2016-03-06 18:08  琴弦0  阅读(169)  评论(1编辑  收藏  举报