GIT :地址

GIT 名字 : jujijuji

学号后5位 : 061224

博客地址 : 博客地址

作业链接 : 第二次作业

(1)环境配置

vs配置

GIT下载

项目地址的复制

GIT配置

(2)代码

···

include "pch.h"

include

include<stdlib.h>

include<time.h>

include

using namespace std;
int num(int x)
{
return rand() % 100;
}
int sign()
{
return rand() % 4;
}
int main()
{
int a, i, j, n;

cout << "请输入题目的数量:";
cin >> a;
srand(time(NULL));
ofstream examplefile("demo.txt");
while (1)
{
if (examplefile.is_open()) {
if (a < 1)
{
cout << "该输入不符合要求";
cin >> a;
}
else
{
for (j = 0; j < a; j++)
{
i = sign();
switch (i)
{
case 0:
cout << j + 1 << ":" << " " << num(1) << "-" << num(2) << "=" << "\n";
examplefile << j + 1 << ":" << " " << num(1) << "+" << num(2) << "=" << "\n";
break;
case 1:
cout << j + 1 << ":" << " " << num(1) << "-" << num(2) << "=" << "\n";
examplefile << j + 1 << ":" << " " << num(1) << "-" << num(2) << "=" << "\n";
break;
case 2:
cout << j + 1 << ":" << " " << num(1) << "" << num(2) << "=" << "\n";
examplefile << j + 1 << ":" << " " << num(1) << "
" << num(2) << "=" << "\n";
break;
case 3:
n = num(2);
if (n != 0)
{
cout << j + 1 << ":" << " " << num(1) << "/" << n << "=" << "\n";
examplefile << j + 1 << ":" << " " << num(1) << "/" << n << "=" << "\n";
}
else
{
j--;
}
break;
}
}
break;
}
}
}
examplefile.close();
return 0;
}
···

感想

由于投入时间太少导致完成质量比较差。继续完成还没有实现的功能。

posted on 2019-09-22 20:40  neonman  阅读(155)  评论(1编辑  收藏  举报