标签:
随机出现俩个数的四则运算:
#include<stdio.h>
#include<iostream>
#include<time.h>
using namespace std;
int main()
{
int i, a, b, c, d;
srand((unsigned)time(NULL));//每次出现随机数不同
a = rand() % 10;
b = rand() % 10;
c = rand() % 4;
switch (c=rand() % 4)
{
case 0:cout << a << "+" << b << "=" << endl; break;
case 1:cout << a << "+" << b << "=" << endl; break;
case 2:cout << a << "+" << b << "=" << endl; break;
case 3:cout << a << "+" << b << "=" << endl; break;
}
}
标签:
原文地址:http://www.cnblogs.com/-beauTiFul/p/5248183.html