程序1
Posted yikechaguazi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了程序1相关的知识,希望对你有一定的参考价值。
#include"iostream.h"
#include"stdlib.h"
#include"math.h"
#include"time.h"
int main(int argc, char* argv[])
{
int num1,num2;
int n;
srand( (unsigned)time( NULL ) );
for(int i=1;i<=30;i++)
{
num1=rand()%100;
num2=rand()%100;
n=rand()%4;
switch(n)
{
case 0:
cout<<i<<" "<<num1<<"+"<<num2<<"="<<endl;
break;
case 1:
if(num1>=num2)
{
cout<<i<<" "<<num1<<"-"<<num2<<"="<<endl;
break;
}
case 2:
cout<<i<<" "<<num1<<"x"<<num2<<"="<<endl;
break;
case 3:
cout<<i<<" "<<num1<<"/"<<num2<<"="<<endl;
break;
}
}
return 0;
}
以上是关于程序1的主要内容,如果未能解决你的问题,请参考以下文章