zoukankan      html  css  js  c++  java
  • 四则运算题目程序

    #include <stdlib.h>
    #include<stdio.h>
    #include <iostream.h>
    #include <conio.h>
    #include <time.h>
    int main()
    {
     int a = 0;
     int b = 0;
     int mode = 0;
     int c = 0;
     int result = 0;
     int score = 0;
     int i = 0;
        for(i=0;i<30;i++)
     {
        a = rand() % 100;
     b = rand() % 100; 
     mode = rand() % 4;     
     printf("%d", a);  
        switch(mode)       
     {         
     case 0:              
      printf("+ ");              
      result= a + b;        
      break;         
     case 1:               
      printf("- ");              
      result= a - b;              
      break;         
     case 2:              
      printf("x ");              
      result= a * b;             
      break;         
     case 3:              
      printf("÷ ");              
      result= a / b;              
      break;         
     default:             
      printf("somethingis wrong! ");              
      break;        
     }
      printf("%d = ", b);        
      scanf("%d", &c);      
      if(c == result)        
      {             
       score+= 10;           
       printf("Right ");        
      }        
      else        
      {             
       printf("Wrong ");      
      }
     }
       printf("Yourscore is: %d ", score);  
       return 1;
    }

  • 相关阅读:
    oracle中delete、truncate、drop的区别
    js获取当前日期时间
    Linux 命令大全
    oracle sql语言模糊查询
    ibatis<iterate>标签
    ibatis中使用like模糊查询
    编辑距离12 · Edit Distance12
    分割回文串 II · Palindrome Partitioning II
    单词拆分 I · Word Break
    300最长上升子序列 · Longest Increasing Subsequence
  • 原文地址:https://www.cnblogs.com/lixin20/p/4366944.html
Copyright © 2011-2022 走看看