Familiar tools

Git address address
Git user name lilyShuangszyzhk
Student ID after five 74121
blog address blog address
Job Link Job Link

A. Environmental carrying

Visual Studio 2017

Because Visual Studio 2017 file relatively large and slow to download, I do not know the edu any problems, even if the library is still a download speed of about 9kb / s, this desperation can only use Visual Studio 2010 to complete the job

git

git to download the installation and use are relatively smoothly, I did not encounter any problems

II. Cloning Project

1. github copy the code on their own warehouse

2. Use git Kelong A super four operations

3. New Folder and create a project

4. Code

I will not be here because the division calculation formula generated to ensure that all divisible only by default A super kid count division will take only divisible part of the ...

#include "stdafx.h"
#include<iostream>
using namespace std;

char s[4]={'+','-','*','/'};

void make(int n)//题目个数 
{
    int ans=0,ch=1,m=0,x,y,z;
    for(int i=1;i<n;i++)
    {
      x=rand()%100+1,y=rand()%4;
      if(s[y]=='*'||s[y]=='/')
      {
        if(m==0)
            ch*=x; 
        else if(m==1)
            ch*=-x;
        else if(m==2)
            ch*=x;
        else
            ch/=x;
      }
      else 
      {
        if(m==0)
            ans+=x;
        else if(m==1)
            ans-=x;
        else if(m==2)
        {
            ch*=x;
            ans+=ch;
            ch=1;
        }
        else
        {
           ch/=x;
           ans+=ch;
           ch=1;    
        }
      }
      cout<<x<<s[y];
      m=y; //前一步的符号 
    }

    z=rand()%100+1;
        if(m==0)
            ans+=z;
        else if(m==1)
            ans-=z;
        else if(m==2)
        {
            ch*=z;
            ans+=ch;
            ch=1;
        }
        else
        {
           ch/=z;
           ans+=ch;
           ch=1;    
        }
    cout<<z<<"= "<<ans<<endl;
    
}
int main()
{
    int seed;
    cout<<"Enter a seed:";
        cin>>seed;//输入随机数种子,防止每次题目相同
        srand(seed);
    for(int i=1;i<=10;++i)
        make(rand()%4+2);//将题目长度控制在四步计算之内 
    return 0;
} 

operation result

testing successfully

Guess you like

Origin www.cnblogs.com/szy211/p/11564146.html