#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void)
{
  int i = 0;
  srand((unsigned)time(NULL)); //本地时间为种子
  while(i<30)
  {
    int a = rand()%100; //产生随机数
    int b = rand()%100;
    int j;
      j = rand()%4; //产生随机符号0到3分别代表四则运算
    printf("%d", a);
    switch(j)
    {
      case 0:
        printf("+");
        break;
      case 1:
        printf("-");
        break;
      case 2:
        printf("*");
        break;
      case 3:
        printf("/");
        break;

    }

    printf("%d", b);
    printf(" = \n");
    i++;
  }

  return 0;
}        //本次实验我觉得我收获颇多,对随机函数有了一定的了解,特别是strand()函数有了初步的认识。

随机的30道四则运算题(简单的c)的更多相关文章

  1. 随机生成30道四则运算题NEW

    代码: #include <iostream> #include <time.h> using namespace std; void main() { srand((int) ...

  2. 随机生成30道四则运算-NEW

    补充:紧跟上一个随机生成30道四则运算的题目,做了一点补充,可以有真分数之间的运算,于是需要在原来的基础上做一些改进. 首先指出上一个程序中的几个不足:1.每次执行的结果都一样,所以不能每天给孩子出3 ...

  3. 软件工程课后作业——用JAVA编写的随机产生30道四则运算

    package com.java.sizeyunsuan; public class lianxi { String f() { int i=(int)(Math.random()*10); int ...

  4. 30道四则运算<1>

    #include<iostream> using namespace std; #define random()(rand()%100) class shuzi //shuzi类的功能是产 ...

  5. 30道四则运算题目---课堂作业--软件工程c++

    问题:设计一程序,给二年级小学生随机产生四则运算题目. 一.设计思考问题: 1.四则运算需要俩个运算数和一个运算符. 2.如何产生随机数? 3.如何实现随机产生四则运算? 4.题目是否符合小学生学习范 ...

  6. Java——自动生成30道四则运算---18.09.27

    package chuti;import java.io.PrintWriter;import java.util.Scanner;import java.io.FileNotFoundExcepti ...

  7. 30道四则运算<2>

    #include<iostream> #include<time.h> #include<fstream> #define random() (rand()%100 ...

  8. 软件工程随堂作业--随机产生30到四则运算(c语言)

    #include "stdio.h" #include "math.h" #include "stdlib.h" #include" ...

  9. 几道web题简单总结

    拖了好长时间,总结一下这一段时间做的几道值得记录一下的题目,有的没做出来,但是学习到了新的东西 1.homebrew event loop ddctf的一道题目,学到了python eval函数的用法 ...

随机推荐

  1. hdu1506

    today, my cc can't make '__in64' it's so bad!!! i don't know why #include <stdio.h> //long lon ...

  2. URL重写以后发布到IIS找不到页面

    1.读取必须勾选,否则无法加载资源文件(img,css等) c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll

  3. activiti搭建(四)八项服务介绍

    转载请注明源地址:http://www.cnblogs.com/lighten/p/5927949.html 1.前言 之前学习的时候一直在其它文章看到activiti提供了七个接口来操作工作流,但在 ...

  4. centos -bash-4.1$ 不显示用户名路径

    1.在Terminal输入: vi ~/.bash_profile 2.如果没有.bash_profile可以自己添加.然后往文件中添加如下内容: export PS1=’[\u@\h \W]$ 注意 ...

  5. jquery animate 动画效果使用说明

    animate( params, [duration], [easing], [callback] ) 用于创建自定义动画的函数. 这个函数的关键在于指定动画形式及结果样式属性对象.这个对象中每个属性 ...

  6. luigi学习9--执行模型

    luigi的执行和触发模型非常简单. 一.luigi的执行模型 当你执行一个luigi的工作流的时候,worker调度所有的task,并且执行task在一个单独的进程中. 这种scheme最大的好处是 ...

  7. dedecms5.7 联动类型无法显示

    dedecms5.7 联动类型无法显示 问题原因:一般是由于路径问题( 路径缺少分隔符'/' )导致js无法正常加载 如果遇到该类问题,尝试通过firebug工具检查js是否被正确加载. 如果是路径问 ...

  8. 简单Spinner

    mainActivity package com.zzw.spinner; import android.app.Activity; import android.content.Context; i ...

  9. 通过API函数来控制SQLite数据库增删改查

    person类属性有Intenger id,String name,Intenger  age,相应的构造方法和set get方法. package com.xh.tx.dao; import and ...

  10. C# A窗口内容显示在B窗口中的方法

    HeScripts script = new HeScripts(); //A窗口中实例化B窗口 string okscripts = "test"; //设置字段内容 scrip ...