Software engineering second base job

Familiar tools


GIT address https://github.com/mxrroy/AchaoCalculator
GIT Username mxrroy
Student ID after five 61201
blog address https://www.cnblogs.com/mxrroy/
Job Link https://www.cnblogs.com/harry240/p/11515697.html


A. Configuration Environment


1. Install vs2017






II. Cloning Project


1. Log on github, the A super four arithmetic library copy to his namesake warehouse


2. Download the Git software


3. Open a command line software Git, git clone input ,among them That is, we just copied the project address




4. Go to the project folder, create a new folder, named for my Github account name




III. Unit testing






IV. Code Design


Specific code:


// 软件工程第二次作业.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。



#include"pch.h"
#include<iostream>
#include<ctime>
#include<fstream>
using namespace std;


int number() {
    int number;
    number = 1 + rand() % 100;
    return number;
}//生成随机数的函数

char operation() {
    char op;
    op = rand() % 4;
    return op;
}
//生成随机运算符的函数

bool decimal(float num)
{
    return num == static_cast<int>(num);
}//判断做除法运算时是否会出现小数



void question2(int num1, int num2) {

    //生成一个随机运算符

    switch (operation())
    {
    case 0:
        cout << num1 << "+" << num2 << "=" << "num1+num2" << endl; break;
    case 1:
        cout << num1 << "-" << num2 << "=" << "num1-num2" << endl; break;
    case 2:
        cout << num1 << "*" << num2 << "=" << "num1*num2" << endl; break;
    case 3:
        cout << num1 << "/" << num2 << "=" << "num1/num2" << endl; break;
    }
}

int main()
{
    int n, m;//生成式子的数量和进行几个数的运算
    int num1, num2, num3;//三个随机数
    char op1, op2;
    int num;//结果

    char a[4] = { '+','-','*','/' };//用一个数组来存放四个运算符

    cout << "你需要多少个式子" << endl;
    cin >> n;
    cout << "你需要进行几个数的运算" << endl;
    cin >> m;

    for (float i = 0; i < n; i++) {
        num1 = number(); num2 = number(); num3 = number();//生成三个随机数
        op1 = operation(); op2 = operation();//生成两个随机运算符

        if (m == 2)
        {
            question2(num1, num2);
        }
        //2个数进行运算的时候
        if (m == 3) {
            do{
                cout << num1 << op1 << num2 << op2 << num3 << "=" <<num<< endl;

            }while (!decimal(num));
        }
        //3个数进行运算的时候

        return 0;
    }
    // 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
    // 调试程序: F5 或调试 >“开始调试”菜单

    // 入门提示: 
    //   1. 使用解决方案资源管理器窗口添加/管理文件
    //   2. 使用团队资源管理器窗口连接到源代码管理
    //   3. 使用输出窗口查看生成输出和其他消息
    //   4. 使用错误列表窗口查看错误
    //   5. 转到“项目”>“添加新项”以创建新的代码文件,或转到“项目”>“添加现有项”以将现有代码文件添加到项目
    //   6. 将来,若要再次打开此项目,请转到“文件”>“打开”>“项目”并选择 .sln 文件
你需要多少个式子  
2
你需要进行几个数的运算
3
55+65*69=
46+52/59=


V. My perception


The job for me there is no small difficulty, whether it is to write code or use of Git and gitub all the services of the roommate and networks. Feeling learning computer is a long process ah, there are a lot of things you need to get to know. Although the homework process is not very satisfactory, but that she really learned something felt very pleased. Some people look at the blog, I found that there are still many chiefs, ha ha, want to have to learn from them ah.

Guess you like

Origin www.cnblogs.com/mxrroy/p/11564376.html
Recommended