计算天天练1.0

这个系列会有很多篇文章,每篇都是计算天天练/质数合数天天练

完整代码:

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <climits>
#include <ctime>
#include <cstdlib>
#include <windows.h>
using namespace std;
//判断是否互质 
int judge_relatively_prime(int a,int b){
	for (int i = 2;i < min(a,b);i++){
		if (a % i == 0&&b % i == 0){//判断是否互质 
			return 0;//不互质返回0 
		}
	}
	return 1;//否则返回1 
}
int main(){
	srand(time(0)); 
	printf("程序开始!\n");
	printf("先看看好玩的吗?\n");
	printf("打一个数字1\n"); 
	int a,cnt = 0;
	cin >> a;
	if (a == 1){
		printf("    你知道吗,贝类有一个特殊的习惯!");
		printf("别的动物啊都把自己的粪便和尿液排在体外,但是据研究发现,几乎所有贝壳都把自己的排泄物排在体内!!!"); 
	} else {
		cout << "本来你还可以做做题的,但因为你不听话,取消资格" << endl;
		cout << "程序结束" << endl;
		return 0;
	}
	printf("可能数字有点大,但是可以笔算\n");
	int haha = 0;
	int b[100],c[100],d[100],e[100];
	for (int i = 0;i < 10;i++){
		b[i] = rand();
	}
	for (int i = 0;i < 50;i++){
		e[i] = rand();
	}
	for (int i = 35;i < 45;i++){
		c[haha] = e[i];
		haha++;
	}
	for (int i = 0;i < 10;i++){
		if (i % 2 == 0){
			printf("%d + %d = ?,请输入答案:",b[i],c[i]);
			cin >> d[i];
			if (d[i] == b[i] + c[i]){
				printf("正确,得1分");
				cnt++;
			} else {
				printf("错误");
			}
			cout << endl;
		} else {
			printf("%d - %d = ?,请输入答案:",b[i],c[i]);
			cin >> d[i];
			if (d[i] == b[i] - c[i]){
				cnt++;
				printf("正确,得1分");
			} else {
				printf("错误");
			}
			cout << endl;	
		}
	}
	if (cnt == 10){
		printf("你得了满分!\n");
		printf("你真棒,再接再厉!\n");
		printf("以后考试还会更新\n");
		printf("程序结束\n");
	} else {
		printf("你得了%d分\n",cnt);
		printf("加油,争取下一次满分!\n");
		printf("以后考试还会更新哦\n");
	}
	printf("计算天天练1.1、1.2、1.3、2.0版本即将出版,敬请期待\n");
	return 0;
}

最后大家投个票,愿意继续更新的在第一个里面投A,中立投B,不愿意投C,再写个理由

                                                        

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值