• 四则运算题目程序


    #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;
    }

  • 相关阅读:
    HDU 1175 连连看 (DFS+剪枝)
    CF702F T-Shirts
    UVA12538 Version Controlled IDE
    P2605 [ZJOI2010]基站选址
    P3835 【模板】可持久化平衡树
    CF915E Physical Education Lessons
    P3701 「伪模板」主席树
    P1198 [JSOI2008]最大数
    P3466 [POI2008]KLO-Building blocks
    P3919 【模板】可持久化数组(可持久化线段树/平衡树)
  • 原文地址:https://www.cnblogs.com/lixin20/p/4366944.html
Copyright © 2020-2023  润新知