分类目录归档:C/C++开发
今天编程学习网为大家讲解c语言用if语句编写四则运算,有需要的小伙伴可以参考一下:#include#include#include#include#includevoidmain(){ints,d=0;inta,b,c,z,v,m;charch[4]={'+','-','x','/'};srand((unsigned)time(null));m=100;b=rand()%m;printf("%d",b);z=b;for(s=0;s<3;s++){a=rand()%4;b=rand()%m;printf("%c%d",ch[a],b);if(a==0){v=z+b;z=b;}if(a==1){v=z-b;z=b;}if(a==2){v=z*b;z=b;}if(a==3){v=z/b;z=b;}}printf("=...
继续阅读 >