#include<bits/stdc++.h>
#include<windows.h>
#include<dir.h>
#define MAX 100
using namespace std;
int shu_zu_1[100001];
void sh(char* p)
{
while (1)
{
if (*p != 0)
printf("%c", *p++);
else
break;
Sleep(30);
}
Sleep(500);
}
int duo_shu_he(int shu_zu_1[],int di_4_time){
int a;
for(int e = 1;e <= di_4_time;e++){
a += shu_zu_1[e];
}
return a;
}
int zhi_shu_pan_duan(int shu_1) {
if(shu_1 < 2){
return 0;
}
for(int zhi_shu = 2;zhi_shu <= sqrt(shu_1);zhi_shu++){
if(shu_1 % zhi_shu == 0){
return 0;
}
}
return 1;
}
int ji_tu_tong_long(int shu_1,int shu_2) {
return shu_2/2-shu_1;
}
long long mi_yun_suan(int shu_1, int shu_2){//幂运算
long long y;
y = shu_1;
for(int i = 2;i <= shu_2;i++){
y *= shu_1;
}
return y;
}
int zui_da_gong_yin_shu(int shu_1,int shu_2){//最大公因数
int ans;
if(shu_1 == shu_2){
ans = shu_1;
}
if(shu_1 > shu_2){
ans = shu_2;
}
if(shu_1 < shu_2){
ans = shu_1;
}
for(int r = ans;r >= 2;r--){
if(shu_1 % r == 0&&shu_2 % r == 0){
return r;
}
}
return 1;
}
int zui_xiao_gong_bei_shu(int shu_1,int shu_2){//最小公倍数
int ans;
if(shu_1 == shu_2){
for(int r = 1;r <= shu_1;r++){
if(shu_2*r%shu_1 == 0){
return shu_2*r;
}
}
}
if(shu_1 > shu_2){
for(int r = 1;r <= shu_2;r++){
if(shu_1*r%shu_2 == 0){
return shu_1*r;
}
}
}
if(shu_1 < shu_2){
for(int r = 1;r <= shu_1;r++){
if(shu_2*r%shu_1 == 0){
return shu_2*r;
}
}
}
}
int pai_xu(int di_4_time,int shu_zu_1[]){//排序
sort(shu_zu_1+1,shu_zu_1+1+di_4_time);
}
int shu_ru_5_2(int shu_1){
int mi_2;
while(1){
cin >> mi_2;
if(shu_1+mi_2 > 25){
cout << "输入错误" << endl;
}else{
cout << "第二个数是————————————" << mi_2 << "————————————\n";
return mi_2;
}
}
}
int shu_ru_5_1(){
int mi_1;
while(1){
cin >> mi_1;
if(mi_1 >= 25){
cout << "输入错误" << endl;
}else{
cout << "第一个数是————————————" << mi_1 << "————————————\n";
return mi_1;
}
}
}
int shu_ru(){
int xuan_ze;
cout << "\n\n你好,请问要使用哪种算法\n1.最大公因数(2数)\n2.最小公倍数(2数)\n3.运算(加减乘除)(2数)\n4.排序(从小到大)(<100001数)\n5.幂运算(2个数加起来不超过25)(2数)\n6.质数判定(1数)\n7.鸡兔同笼(2数)\n8.统计多数之和(<100001数)\n" ;
while(1){
cin >> xuan_ze;
if(xuan_ze <= 8 || xuan_ze >= 1){
return xuan_ze;
}
cout << "输入错误" << endl;
}
}
void yun_suan_choice1(int shu_1,int shu_2){
cout <<"\n加:(" << shu_1 << ")+(" << shu_2 << ")=("<< shu_1+shu_2 << ")" << "\n第一个数减第二个数:(" << shu_1 << ")-(" << shu_2 << ")=" << shu_1-shu_2 <<"\n第二个数减第一个数:(" << shu_2 << ")-(" << shu_1 << ")="<< shu_2-shu_1 << "\n乘:(" << shu_1 << ")*(" <<shu_2 << ")="<< shu_1*shu_2 << endl;
if(shu_1%shu_2 == 0) {
cout << "第一个数除以第二个数:(" << shu_1 << ")/(" << shu_2 << ")=" << shu_1/shu_2 << endl ;
}else{
cout << "第一个数除以第二个数:(" << shu_1 << ")/(" << shu_2 << ")=" << shu_1/shu_2 << "余" << shu_1%shu_2 << endl;
}if(shu_2%shu_1 == 0) {
cout << "第二个数除以第一个数:(" << shu_2 << ")/(" << shu_1 << ")=" << shu_2/shu_1 << "\n\n";
}else{
cout << "第二个数除以第一个数:(" << shu_2 << ")/(" << shu_1 << ")=" << shu_2/shu_1 << "余" << shu_2%shu_1 << "\n\n";
}
}
void yun_suan_choice2(int shu_1,int shu_2){
cout <<"\n加:(" << shu_1 << ")+" << shu_2 << "="<< shu_1+shu_2 << "\n第一个数减第二个数:(" << shu_1 << ")-" << shu_2 << "=" << shu_1-shu_2 <<"\n第二个数减第一个数:" << shu_2 << "-(" << shu_1 << ")="<< shu_2-shu_1 << "\n乘:(" << shu_1 << ")*" <<shu_2 << "="<< shu_1*shu_2 << endl;
if(shu_1%shu_2 == 0) {
cout << "第一个数除以第二个数:(" << shu_1 << ")/" << shu_2 << "=" << shu_1/shu_2 << endl ;
}else{
cout << "第一个数除以第二个数:(" << shu_1<< ")/" << shu_2 << "=" << shu_1/shu_2 << "余" << shu_2%shu_2 << endl;
}if(shu_2%shu_1 == 0) {
cout << "第二个数除以第二个数:" << shu_2 << "/(" << shu_1 << ")=" << shu_2/shu_1 << "\n\n";
}else{
cout << "第二个数除以第一个数:" << shu_2 << "/(" << shu_1 << ")=" << shu_2/shu_1 << "余" << shu_2%shu_1 << "\n\n";
}
}
void yun_suan_choice3(int shu_1,int shu_2){
cout << "\n加:" << shu_1 << "+(" << shu_2 << ")="<< shu_1+shu_2 <<"\n第一个数减第二个数:" << shu_1 << "-(" << shu_2 << ")=" << shu_1-shu_2 << "\n第二个数减第一个数:(" << shu_2 << ")-" << shu_1 << "="<< shu_2-shu_1 << "\n乘:" << shu_1 << "*(" <<shu_2 << ")="<< shu_1*shu_2 << endl;
if(shu_1%shu_2 == 0) {
cout << "第一个数除以第二个数:" << shu_1 << "/(" << shu_2 << ")=" << shu_1/shu_2 << endl ;
}else{
cout << "第一个数除以第二个数:" << shu_1 << "/(" << shu_2 << ")=" << shu_1/shu_2 << "余" << shu_1%shu_2 << endl;
}if(shu_2%shu_1 == 0) {
cout << "第二个数除以第二个数:(" << shu_2 << ")/" << shu_1 << "=" << shu_2/shu_1 << "\n\n";
}else{
cout << "第二个数除以第一个数:(" << shu_2 << ")/" << shu_1 << "=" << shu_2/shu_1 << "余" << shu_2%shu_1 << "\n\n";
}
}
void yun_suan_choice4(int shu_1,int shu_2){
cout << "\n加:" << shu_1 << "+" << shu_2 << "="<< shu_1+shu_2 << "\n第一个数减第二个数:" << shu_1 << "-" << shu_2 << "=" << shu_1-shu_2 << "\n第二个数减第一个数:" << shu_2 << "-" << shu_1 << "="<< shu_2-shu_1 << "\n乘:" << shu_1 << "*" <<shu_2 << "="<< shu_1*shu_2 << endl;
if(shu_1%shu_2 == 0) {
cout << "第一个数除以第二个数:" << shu_1 << "/" << shu_2 << "=" << shu_1/shu_2 << endl ;
}else{
cout << "第一个数除以第二个数:" << shu_1 << "/" << shu_2 << "=" << shu_1/shu_2 << "余" << shu_1%shu_2 << endl;
}if(shu_2%shu_1 == 0) {
cout << "第二个数除以第二个数:" << shu_2 << "/" << shu_1 << "=" << shu_2/shu_1 <<"\n\n";
}else{
cout << "第二个数除以第一个数:" << shu_2 << "/" << shu_1 << "=" << shu_2/shu_1 << "余" << shu_2%shu_1 << "\n\n";
}
}
int main(){
sh("改进\n");
sh("警告:如果输入数字过大,可能无法运行\n");
sh("原创&&改进\n");
int shu_1,shu_2,shu_ru_end,jie_shu,di_4_time;
while(1){
shu_ru_end = shu_ru();
if(shu_ru_end == 1){
sh("请输入(2个数)\n");
cin >> shu_1 ;
cout << "第一个数是————————————" << shu_1 << "————————————\n";
cin >> shu_2;
cout << "第二个数是————————————" <<shu_2 << "————————————\n";
cout <<"\n答案是:"<< zui_da_gong_yin_shu(shu_1,shu_2) << "\n\n";
sh("请问你答对了吗(1.对/2.错)\n");
int ss;
cin >> ss;
if(ss == 1){
for (int ii = 1; ii <= 3; ii++) {
system("color 10");
system("color 20");
system("color 30");
system("color 40");
system("color 50");
system("color 60");
system("color 70");
system("color 80");
system("color 90");
system("color a0");
system("color b0");
system("color c0");
system("color d0");
system("color e0");
}
sh("你赞!!\n");
sh("继续加油!\n");
}else{
sh("不要气垒,再接再厉!\n");
}
}else if(shu_ru_end == 2){
sh("请输入(2个数):");
cin >> shu_1 ;
cout << "第一个数是————————————" << shu_1 << "————————————\n";
cin >> shu_2;
cout << "第二个数是————————————" <<shu_2 << "————————————\n";
cout << "\n答案是:"<< zui_xiao_gong_bei_shu(shu_1,shu_2) <<"\n\n";
sh("请问你答对了吗(1.对/2.错)\n");
int sss;
cin >> sss;
if(sss == 1){
for (int ii = 1; ii <= 3; ii++) {
system("color 10");
system("color 20");
system("color 30");
system("color 40");
system("color 50");
system("color 60");
system("color 70");
system("color 80");
system("color 90");
system("color a0");
system("color b0");
system("color c0");
system("color d0");
system("color e0");
}
sh("你赞!!\n");
sh("继续加油!\n");
}else{
sh("不要气垒,再接再厉!\n");
}
}else if(shu_ru_end == 3){
sh("请输入(2个数)\n");
cin >> shu_1 >> shu_2;
if(shu_1 < 0&&shu_2 < 0){
yun_suan_choice1(shu_1,shu_2);
}else if(shu_1 < 0&&shu_2 >= 0){
yun_suan_choice2(shu_1,shu_2);
}else if(shu_2< 0&&shu_1 >= 0){
yun_suan_choice3(shu_1,shu_2);
}else{
yun_suan_choice4(shu_1,shu_2);
}
}else if(shu_ru_end== 4){
cout << "请问要输入多少个数(不超过100000个数)\n";
cin >> di_4_time;
if(di_4_time > 100000){
di_4_time = 100000;
}
cout << "请输入" << di_4_time << "个数";
for(int ci = 1;ci <= di_4_time;ci++){
cout << shu_zu_1[ci] << " ";
}cout << "\n" ;
}else if(shu_ru_end == 5){
cout << "请输入(2个数)\n" ;
shu_1 = shu_ru_5_1();
shu_2 = shu_ru_5_2(shu_1);
cout << "答案是:"<< mi_yun_suan(shu_1,shu_2) << endl;
sh("请问你答对了吗(1.对/2.错)\n");
int sub;
cin >> sub;
if(sub == 1){
for (int ii = 1; ii <= 3; ii++) {
system("color 10");
system("color 20");
system("color 30");
system("color 40");
system("color 50");
system("color 60");
system("color 70");
system("color 80");
system("color 90");
system("color a0");
system("color b0");
system("color c0");
system("color d0");
system("color e0");
}
sh("你赞!!\n");
sh("继续加油!\n");
}else{
sh("不要气垒,再接再厉!\n");
}
}else if(shu_ru_end == 6){
sh("请输入(1个数):");
cin >> shu_1;
if(zhi_shu_pan_duan(shu_1)) {
cout << "质数\n\n\n" ;
}else {
cout << "不是质数\n\n\n";
}
}else if(shu_ru_end == 7){
sh("请输入(2个数)\n");
cin >> shu_1 >> shu_2;
cout << "有:" << ji_tu_tong_long(shu_1,shu_2) << "只兔子\n有:" << shu_1-ji_tu_tong_long(shu_1,shu_2) << "只鸡\n\n\n" ;
sh("请问你答对了吗(1.对/2.错)\n");
int yyds;
cin >> yyds;
if(yyds == 1){
for (int ii = 1; ii <= 3; ii++) {
system("color 10");
system("color 20");
system("color 30");
system("color 40");
system("color 50");
system("color 60");
system("color 70");
system("color 80");
system("color 90");
system("color a0");
system("color b0");
system("color c0");
system("color d0");
system("color e0");
}
sh("你赞!!\n");
sh("继续加油!\n");
}else{
sh("不要气垒,再接再厉!\n");
}
}else if(shu_ru_end == 8) {
cout << "请问要输入多少个数(不超过100000个数)\n";
cin >> di_4_time;
if(di_4_time > 100000){
di_4_time = 100000;
}
cout << "请输入" << di_4_time << "个数/n";
for(int ci = 1;ci <= di_4_time;ci++){
cin >> shu_zu_1[ci];
}
int ugg;
cout << "答案是:" << duo_shu_he(shu_zu_1,di_4_time) << "\n\n\n";
sh("请问你答对了吗(1.对/2.错)\n");
cin >> ugg;
if(ugg == 1){
for (int ii = 1; ii <= 3; ii++) {
system("color 10");
system("color 20");
system("color 30");
system("color 40");
system("color 50");
system("color 60");
system("color 70");
system("color 80");
system("color 90");
system("color a0");
system("color b0");
system("color c0");
system("color d0");
system("color e0");
}
sh("你赞!!\n");
sh("继续加油!\n");
}else{
sh("不要气垒,再接再厉!\n");
}
}
cout << "请问还要算吗?" <<"\n1.要" << "\n2.不要\n" ;
cin >> jie_shu;
if(jie_shu == 2) {
break;
}
}
return 0;
}