zoukankan      html  css  js  c++  java
  • 2015.3.6的程序实践

    此程序实现的是200以内的随机整数的四则运算

    代码:

    #include<iostream.h>
    #include<stdlib.h>
    int main()
    {
            int i,a,b,c,k;
            for (i=0;i<=29;i++)
           {
                 a=rand()%200;
                 b=rand()%200;
                 if(b>a)
                 {
                      c=a;
                      a=b;
                      b=c;
                  }
                  k=rand()%4;
                  if(k==0)
                       cout<<a<<"+"<<b<<"="<<endl;
                  if(k==1)
                       cout<<a<<"-"<<b<<"="<<endl;
                  if(k==2)
                       cout<<a<<"*"<<b<<"="<<endl;
                  if(k==3)
                       cout<<a<<"/"<<b<<"="<<endl;
            }
            return 0;
    }

  • 相关阅读:
    构建之法阅读笔记05
    构建之法阅读笔记04
    构建之法阅读笔记03
    学习进度条
    软件工程练习——买书
    软件工程练习——找水王2
    Java作业07
    Java课堂作业06
    读《大道至简》第六章有感
    Java课堂作业05
  • 原文地址:https://www.cnblogs.com/lsfh/p/4318024.html
Copyright © 2011-2022 走看看