四则运算器 语言:C语言 编译环境:VS2013 运行环境:Windows BUG:暂未发现BUG GitHub地址:https://github.com/121802102/1/blob/master/%E5%9B%9B%E5%88%99%E8%BF%90%E7%AE%97%E5%99%A8
语言:C语言 编译环境:VC++6.0 运行环境:Windows BUG:暂未发现BUG GitHub地址:https://github.com/121802102/1/blob/master/%E5%9B%9B%E5%88%99%E8%BF%90%E7%AE%97%E5%99%A8
并未作出修改,代码来源于网上。
代码如下
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <time.h> | |
| #include <math.h> | |
| int main() | |
| { | |
| int i = 0; | |
| int n = 0; | |
| int x = 0; | |
| int类型 | |
| char标志 | |
| int左,右; | |
| 浮动结果; | |
| 的printf( “请输入要出的题目个数\ n”); | |
| 的scanf( “%d个”,&N); | |
| 函数srand(无符号(时间(NULL))); | |
| 而(X <N) | |
| { | |
| type = rand()%4; | |
| left = rand()%100; | |
| right = rand()%100; | |
| 开关(类型) | |
| { | |
| 情况0: | |
| printf(“%d +%d =?\ n”,左,右); | |
| 打破; | |
| 情况1: | |
| printf(“%d - %d =?\ n”,左,右); | |
| 打破; | |
| 情况2: | |
| printf(“%d *%d =?\ n”,左,右); | |
| 打破; | |
| 情况3: | |
| printf(“%d /%d =?\ n”,左,右); | |
| 打破; | |
| } | |
| 我++; | |
| 而(ⅰ> = n)的 | |
| { | |
| printf(“一共有%d道题\ n”,i); | |
| 的printf( “?继续[Y / N] \ n上”); | |
| fflush(标准输入); | |
| 的scanf( “%C”,&标志); | |
| 如果(标志== 'Y' ||标志== 'y')的 | |
| { | |
| 的printf( “请输入要出的题目个数\ n”); | |
| 的scanf( “%d个”,&N); | |
| I = 0; | |
| 打破; | |
| } | |
| 的printf( “!感谢你的使用\ n”); | |
| fflush(标准输入); | |
| 的getchar(); | |
| 返回0; | |
| } | |
| } | |
| } |
---恢复内容结束---

浙公网安备 33010602011771号