问题标题: 酷町堂:自定义计算<2.2>

1
0
已解决
许金夫
许金夫
初级天翼
初级天翼

更新啦~更新啦~

本次更新的是汉诺塔~

休想AC!

#include <bits/stdc++.h>
#include<windows.h>
using namespace std;


string ss1="好消息,好消息!<自定义计算>更新了!!!";
string ss2="<自定义计算2.0>将会有以下更新:";
string ss3="[1]:1.0系统中复杂的if将由函数代替";
string ss4="[2]:2.0更新将出现多种算法!!!";
string ss5="[3]:吐槽一下,希望这次不要再有人盗版我的代码了~";
string ss6="好了,话不多说,看一看这次<自定义计算>全家桶将加入那些算法吧~"; 
string ss7="||            ————请选择项目————                               ||";
string ss8="||                 [1]<高精度>                                         ||";
string ss9="||                 [2]<递推>                                           ||";
string ss10="||                 [3]<递归>                                           ||"; 


string ss1_1="||                 [1]<高精度>x+y                                      ||";
string ss1_2="||                 [2]<高精度>x-y                                      ||";
string ss1_3="||                 [3]<高精度>x*y                                      ||";
string ss2_1="||                 [1]<递推>杨辉三角                                   ||";
string ss2_2="||                 [2]<递推>斐波那契                                   ||";
string ss3_1="||                 [1]<递归>八皇后                                     ||";
string ss3_2="||                 [2]<递归>汉诺塔                                     ||"; 


 
static int gEightQueen[8] = { 0 }, gCount = 0;//八皇后的定义 
 
 
 
void print()//八皇后
{
    for (int i = 0; i < 8; i++)
    {   
    	cout<<"                            |"; 
        int inner;
        for (inner = 0; inner < gEightQueen[i]; inner++)
            cout << " ";
            cout <<"#";
        for (inner = gEightQueen[i] + 1; inner < 8; inner++)
            cout << " ";
        cout<<"|"; 
        cout << endl;
    }
    cout << "                            ==========\n";
    Sleep(1000);
}
int check_pos_valid(int loop, int value){//八皇后
    int index;
    int data;
    for (index = 0; index < loop; index++)
    {
        data = gEightQueen[index];
        if (value == data)
            return 0;
        if ((index + data) == (loop + value))
            return 0;
        if ((index - data) == (loop - value))
            return 0;
    }
    return 1;
}
void eight_queen(int index)//八皇后 
{
	int loop;
    for (loop = 0; loop < 8; loop++)
    {
        if (check_pos_valid(index, loop))
        {
            gEightQueen[index] = loop;
            if (7 == index)
            {
                gCount++, print();
                gEightQueen[index] = 0;
                return;
            }
            eight_queen(index + 1);
            gEightQueen[index] = 0;
        }
    }
}
void dg1(){//八皇后主函数
	string s8h1="八皇后问题--------一个古老而著名的问题,是回溯算法的典型案例。";
	string s8h2="下面将会输出所有八皇后的选项<此题在题库里无法AC>,所有的'#'代表皇后,为了方便观看,每次输出后将会暂停1秒,请耐心等待~";
	for(int i=0;i<s8h1.size();i++){
		cout<<s8h1[i];
		Sleep(50);
	}
	cout<<endl;
	for(int i=0;i<s8h2.size();i++){
		cout<<s8h2[i];
		Sleep(50);
	}
	Sleep(500);
	eight_queen(0);
    cout << "总数为=" << gCount << endl;
}  
int cc;//汉诺塔
void Move(int n, char a, char b){//汉诺塔
    printf("第%d次移动 Move %d: Move from %c to %c !\n",++cc,n,a,b);
    Sleep(100); 
}
void Hanoi(int n, char a, char b, char c)//汉诺塔
{
    if (n == 1)
    {
        Move(n, a, c);
    }
    else
    {
        Hanoi(n - 1, a, c, b);
        Move(n, a, c);
        Hanoi(n - 1, b, a, c);
    }
}
void dg2(){//汉诺塔主函数 
	int n=8;
    printf("汉诺塔的层数:\n");
    scanf(" %d",&n);
    Hanoi(n, 'A', 'B', 'C');
} 
void gj1(){//高精度加法
	int a[100005];
	int b[100005];
	int c[100005];
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	memset(c,0,sizeof(c));
	string s1,s2;
	cout<<"加数x:";
    cin>>s1;
    cout<<"加数y:";
	cin>>s2;
    a[0]=s1.size();
    b[0]=s2.size();
    for(int i=1;i<=s1.size();i++)a[i]=int(s1[a[0]-i]-'0');
    for(int i=1;i<=s2.size();i++)b[i]=int(s2[b[0]-i]-'0');
    c[0]=max(a[0],b[0]);
    int jw=0;
    for(int i=1;i<=c[0];i++){
        c[i]=a[i]+b[i]+jw;
        jw=c[i]/10;
        c[i]%=10;
    }
    if(jw==1){
        c[0]++;
        c[c[0]]=jw;
    }
    cout<<"x+y=";
    for(int i=c[0];i>=1;i--){
        cout<<c[i];
    }
} 
void gj2(){//高精度减法 
	string sd,se,sa;  
    int a[100001]{0},b[100001]{0},c[100001]{0},mc,me,mz,n,mo=0; 
	cout<<"减数x:"; 
    cin>>sd;  
    cout<<"减数y:";
    cin>>se; 
	mc=sd.size();  
    me=se.size();  
    if(mc<me||mc==me&&sd<se){sa=sd;sd=se;se=sa;n=mc;mc=me;me=n;mo=-1;}   
    for(int i=1;i<=mc;i++) a[i]=sd[mc-i]-'0';  
    for(int i=1;i<=me;i++) b[i]=se[me-i]-'0';  
    int i=1,o=0;  
    while(i<=mc||i<=me)  
    {  
        if(a[i]<b[i]){a[i+1]--;a[i]+=10;}  
        c[i]=a[i]-b[i];  
        i++;  
    }  
    mz=i;while(c[mz]==0&&mz>1)mz--; 
	cout<<"x-y="; 
    if(mo==-1) cout<<"-";  
    for(int i=mz;i>=1;i--) cout<<c[i];  
}
void gj3(){//高精度乘法 
	string sa="",sb="",st="";
	int la=0,lb=0,lc=0,tla=0,tlb=0,t=0;
	bool isuselesszero=true;
	vector <int> a,b,c;
	cout<<"乘数x:";
	cin>>sa;
	cout<<"乘数y:";
	cin>>sb;
    if(sa[0]=='0' || sb[0]=='0') {
		cout<<0; 
		return ;
	}
    la=sa.length(); lb=sb.length();
    if(la>lb){
		swap(sa,sb); 
		la=sa.length(); 
		lb=sb.length();
	}
    lc=max(la,lb); 
	tla=la; 
	tlb=lb;
    reverse(sa.begin(),sa.end()); 
	reverse(sb.begin(),sb.end());
    while(tla<lc){
		sa+='0'; 
		tla=sa.length();
	}
    while(tlb<lc){
		sb+='0'; 
		tlb=sb.length();
	}
    for(int i=0;i<1000000;i++) c.push_back(0);
    for(int i=0;i<lc;i++){
		a.push_back((sa[i]-'0')); 
		b.push_back((sb[i]-'0'));
	}
    for(int i=0;i<lb;i++){
        for(int j=0;j<la;j++){
            c[i+j]+=a[j]*b[i];
            if(c[i+j]>=10){
                c[i+j+1]+=c[i+j]/10;
                c[i+j]%=10;
            }
        }
    }
    reverse(c.begin(),c.end());
    cout<<"x*y=";
    for(int i=0;i<1000000;i++){
        if(isuselesszero&&c[i]==0) continue;
        if(c[i]!=0) isuselesszero=false;
        if(c[i]<10) cout<<c[i];
        else{
            c[i-1]=c[i]/10;
            c[i]%=10;
            cout<<c[i];
        }
    }
    return ;
}
void dt1(){//杨辉三角
	int n;
	cin>>n; 
    const int m = 2 * n-1;
    int arr[n + 1][m] = { 0 };
    for (int i = 0; i < n; i++)
    {
        arr[i][n - i- 1] = 1;
        arr[i][n + i -1] = 1;
    }
    for (int i = 2; i < n; i++)
    {
        for (int j = n - i + 1; j < n-2+i; j = j + 2)
            arr[i][j] = arr[i - 1][j - 1] + arr[i - 1][j + 1];
    }
    int p;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n - i - 1; j++)
            cout << "    ";
        p = 1;
        for (int j = n - i - 1; p < i + 2; j = j + 2)
        {
            cout << setw(4) << arr[i][j] << "    ";
            p = p + 1;
        }
        cout << endl;
    }
} 
void dt2(){//斐波那契数列 
	int a[10000],b[10000]; 
	string s1="1",s2="1"; 
	char x[1200];
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	int s,n,sum;
	cout<<"你求的是第几个数列:";
    cin>>n;
    for(int j=2;j<n;j++) { 
        memset(a,0,sizeof(a));
        memset(b,0,sizeof(b));
        a[0]=s1.size(); 
        b[0]=s2.size(); 
        for(int i=1;i<=a[0];i++){ 
            a[i]=s1[a[0]-i]-'0';
		} 
        for(int i=1;i<=b[0];i++){ 
            b[i]=s2[b[0]-i]-'0';
		}
        sum=max(a[0],b[0]);
        for(int i=1;i<=sum;i++){ 
            a[i]+=b[i]; 
            a[i+1]+=a[i]/10; 
            a[i]%=10;} 
        sum++; 
        while(!(a[sum])&&(sum>1))sum--;
        s=0;
        for(int i=sum;i>=1;i--)x[s++]=a[i]+'0'; 
        s1=s2; 
        s2=x; 
    } 
    cout<<s2;
}
int main(){
	for(int i=0;i<5;i++){
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ..";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ...";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"             .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"              .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"               .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                ........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                 .......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                  ......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                   .....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                    ....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                     ...";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                      ..";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                       .";system("cls");
	}
	system("cls");
	int zh,mm;//账号,密码
	cout << endl << endl << endl << endl ;
	cout<<"                     -------自定义计算 2.0-------"<<endl<<endl;
	cout<<"                 Hello~ :) 欢迎来到全新的自定义计算2.0----5/20版"<<endl; 
	cout<<"                     请输入账号:";cin>>zh;
	cout<<"                     请输入密码:";cin>>mm;
	int qw;
	bool qe=1;
	if(zh==123456&&mm==456789)qw=1;
	else qw=2;
	while(qw){
		system("cls");
		if(qe==1){	
			for(int i=0;i<ss1.size();i++){
				cout<<ss1[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<ss2.size();i++){
				cout<<ss2[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<ss3.size();i++){
				cout<<ss3[i];
				Sleep(50); 
			} 
			cout<<endl;
			for(int i=0;i<ss4.size();i++){
				cout<<ss4[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<ss5.size();i++){
				cout<<ss5[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<ss6.size();i++){
				cout<<ss6[i];
				Sleep(50);
			} 
			cout<<endl;
			qe=0;
		}
		cout<<ss7<<endl;
		cout<<ss8<<endl;
		cout<<ss9<<endl;
		cout<<ss10<<endl; 
		int xuanxiang;//选项------------------------------------------------------------ 
		cout<<"请选择功能:"; 
		cin>>xuanxiang; 
		if(xuanxiang==1){//高精度 
			system("cls");
			cout<<ss7<<endl;
			cout<<ss1_1<<endl;
			cout<<ss1_2<<endl;
			cout<<ss1_3<<endl;
			int xuanxiang1;
			cout<<"你的选择:";
			cin>>xuanxiang1; 
			if(xuanxiang1==1){
				system("cls");
				gj1();
				Sleep(500);
			}
			else if(xuanxiang1==2){
				system("cls");
				gj2();
				Sleep(500);
			}
			else if(xuanxiang1==3){
				system("cls");
				gj3();
				Sleep(500);
			}
		}
		
		
		else if(xuanxiang==2){//递推 
			system("cls");
			cout<<ss7<<endl;
			cout<<ss2_1<<endl;
			cout<<ss2_2<<endl;
			int xuanxiang1;
			cout<<"你的选择:";
			cin>>xuanxiang1; 
			if(xuanxiang1==1){
				system("cls");
				dt1();
				Sleep(500);
			}
			else if(xuanxiang1==2){
				system("cls");
				dt2();
				Sleep(500);
			}
		}
		
		else if(xuanxiang==3){//递归 
			system("cls");
			cout<<ss7<<endl;
			cout<<ss3_1<<endl;
			cout<<ss3_2<<endl;
			int xuanxiang1;
			cout<<"你的选择:";
			cin>>xuanxiang1; 
			if(xuanxiang1==1){
				system("cls");
				dg1();
				Sleep(500);
			}
			else if(xuanxiang1==2){
				system("cls");
				dg2();
				cc=0; 
				Sleep(500);
			}
		}
		cout<<endl;
		cout<<"是否退出?"<<endl;
		cout<<"[1]:继续"<<endl;
		cout<<"[0]:退出"<<endl;
		cout<<"你的选择:";
		cin>>qw;
	} 
	return 0;
} 

觉得好就给个赞吧

许金夫在2020-05-23 21:32:14追加了内容

本次更新

【1】增加了高精度除法(太难了555)

【2】修改了八皇后大家看着太急的问题,增加了一些细节

#include <bits/stdc++.h>
#include<windows.h>
using namespace std;
#define DIGIT   4  
#define DEPTH   10000  
#define MAX     30000  

string ss1="好消息,好消息!<自定义计算>更新了!!!";
string ss2="<自定义计算2.0>将会有以下更新:";
string ss3="[1]:1.0系统中复杂的if将由函数代替";
string ss4="[2]:2.0更新将出现多种算法!!!";
string ss5="[3]:吐槽一下,希望这次不要再有人盗版我的代码了~";
string ss6="好了,话不多说,看一看这次<自定义计算>全家桶将加入那些算法吧~"; 
string ss7="||            ————请选择项目————                               ||";
string ss8="||                 [1]<高精度>                                         ||";
string ss9="||                 [2]<递推>                                           ||";
string ss10="||                 [3]<递归>                                           ||"; 


string ss1_1="||                 [1]<高精度>x+y                                      ||";
string ss1_2="||                 [2]<高精度>x-y                                      ||";
string ss1_3="||                 [3]<高精度>x*y                                      ||";
string ss1_4="||                 [4]<高精度>x/y                                      ||";
string ss2_1="||                 [1]<递推>杨辉三角                                   ||";
string ss2_2="||                 [2]<递推>斐波那契                                   ||";
string ss3_1="||                 [1]<递归>八皇后                                     ||";
string ss3_2="||                 [2]<递归>汉诺塔                                     ||"; 


 
static int gEightQueen[8] = { 0 }, gCount = 0;//八皇后的定义 
typedef int bignum_t[MAX+1];//高精度除法的定义 
 
 
void print()//八皇后
{
	cout<<"第"<<gCount<<"个八皇后排列-----------------------------------"<<endl;
	cout<<"                            =========="<<endl;
    for (int i = 0; i < 8; i++)
    {    
    	cout<<"                            |"; 
        int inner;
        for (inner = 0; inner < gEightQueen[i]; inner++)
            cout << " ";
            cout <<"#";
        for (inner = gEightQueen[i] + 1; inner < 8; inner++)
            cout << " ";
        cout<<"|"; 
        cout << endl;
    }
    cout<<"                            =========="<<endl;
    Sleep(200);
}
int check_pos_valid(int loop, int value){//八皇后
    int index;
    int data;
    for (index = 0; index < loop; index++)
    {
        data = gEightQueen[index];
        if (value == data)
            return 0;
        if ((index + data) == (loop + value))
            return 0;
        if ((index - data) == (loop - value))
            return 0;
    }
    return 1;
}
void eight_queen(int index)//八皇后 
{
	int loop;
    for (loop = 0; loop < 8; loop++)
    {
        if (check_pos_valid(index, loop))
        {
            gEightQueen[index] = loop;
            if (7 == index)
            {
                gCount++, print();
                gEightQueen[index] = 0;
                return;
            }
            eight_queen(index + 1);
            gEightQueen[index] = 0;
        }
    }
}
void dg1(){//八皇后主函数
	string s8h1="八皇后问题--------一个古老而著名的问题,是回溯算法的典型案例。";
	string s8h2="下面将会输出所有八皇后的选项<此题在题库里无法AC>,所有的'#'代表皇后,为了方便观看,每次输出后将会稍加暂停,请耐心等待~";
	for(int i=0;i<s8h1.size();i++){
		cout<<s8h1[i];
		Sleep(50);
	}
	cout<<endl;
	for(int i=0;i<s8h2.size();i++){
		cout<<s8h2[i];
		Sleep(50);
	}
	cout<<endl;
	Sleep(100);
	eight_queen(0);
    cout << "总数为=" << gCount << endl;
}  
int cc;//汉诺塔
void Move(int n, char a, char b){//汉诺塔
    printf("第%d次移动 Move %d: Move from %c to %c !\n",++cc,n,a,b);
    Sleep(100); 
}
void Hanoi(int n, char a, char b, char c)//汉诺塔
{
    if (n == 1)
    {
        Move(n, a, c);
    }
    else
    {
        Hanoi(n - 1, a, c, b);
        Move(n, a, c);
        Hanoi(n - 1, b, a, c);
    }
}
void dg2(){//汉诺塔主函数 
	int n=8;
    printf("汉诺塔的层数:\n");
    scanf(" %d",&n);
    Hanoi(n, 'A', 'B', 'C');
} 
void gj1(){//高精度加法
	int a[100005];
	int b[100005];
	int c[100005];
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	memset(c,0,sizeof(c));
	string s1,s2;
	cout<<"加数x:";
    cin>>s1;
    cout<<"加数y:";
	cin>>s2;
    a[0]=s1.size();
    b[0]=s2.size();
    for(int i=1;i<=s1.size();i++)a[i]=int(s1[a[0]-i]-'0');
    for(int i=1;i<=s2.size();i++)b[i]=int(s2[b[0]-i]-'0');
    c[0]=max(a[0],b[0]);
    int jw=0;
    for(int i=1;i<=c[0];i++){
        c[i]=a[i]+b[i]+jw;
        jw=c[i]/10;
        c[i]%=10;
    }
    if(jw==1){
        c[0]++;
        c[c[0]]=jw;
    }
    cout<<"x+y=";
    for(int i=c[0];i>=1;i--){
        cout<<c[i];
    }
} 
void gj2(){//高精度减法 
	string sd,se,sa;  
    int a[100001]{0},b[100001]{0},c[100001]{0},mc,me,mz,n,mo=0; 
	cout<<"减数x:"; 
    cin>>sd;  
    cout<<"减数y:";
    cin>>se; 
	mc=sd.size();  
    me=se.size();  
    if(mc<me||mc==me&&sd<se){sa=sd;sd=se;se=sa;n=mc;mc=me;me=n;mo=-1;}   
    for(int i=1;i<=mc;i++) a[i]=sd[mc-i]-'0';  
    for(int i=1;i<=me;i++) b[i]=se[me-i]-'0';  
    int i=1,o=0;  
    while(i<=mc||i<=me)  
    {  
        if(a[i]<b[i]){a[i+1]--;a[i]+=10;}  
        c[i]=a[i]-b[i];  
        i++;  
    }  
    mz=i;while(c[mz]==0&&mz>1)mz--; 
	cout<<"x-y="; 
    if(mo==-1) cout<<"-";  
    for(int i=mz;i>=1;i--) cout<<c[i];  
}
void gj3(){//高精度乘法 
	string sa="",sb="",st="";
	int la=0,lb=0,lc=0,tla=0,tlb=0,t=0;
	bool isuselesszero=true;
	vector <int> a,b,c;
	cout<<"乘数x:";
	cin>>sa;
	cout<<"乘数y:";
	cin>>sb;
    if(sa[0]=='0' || sb[0]=='0') {
		cout<<0; 
		return ;
	}
    la=sa.length(); lb=sb.length();
    if(la>lb){
		swap(sa,sb); 
		la=sa.length(); 
		lb=sb.length();
	}
    lc=max(la,lb); 
	tla=la; 
	tlb=lb;
    reverse(sa.begin(),sa.end()); 
	reverse(sb.begin(),sb.end());
    while(tla<lc){
		sa+='0'; 
		tla=sa.length();
	}
    while(tlb<lc){
		sb+='0'; 
		tlb=sb.length();
	}
    for(int i=0;i<1000000;i++) c.push_back(0);
    for(int i=0;i<lc;i++){
		a.push_back((sa[i]-'0')); 
		b.push_back((sb[i]-'0'));
	}
    for(int i=0;i<lb;i++){
        for(int j=0;j<la;j++){
            c[i+j]+=a[j]*b[i];
            if(c[i+j]>=10){
                c[i+j+1]+=c[i+j]/10;
                c[i+j]%=10;
            }
        }
    }
    reverse(c.begin(),c.end());
    cout<<"x*y=";
    for(int i=0;i<1000000;i++){
        if(isuselesszero&&c[i]==0) continue;
        if(c[i]!=0) isuselesszero=false;
        if(c[i]<10) cout<<c[i];
        else{
            c[i-1]=c[i]/10;
            c[i]%=10;
            cout<<c[i];
        }
    }
    return ;
}







int read(bignum_t a,istream& is=cin){  //高精度除法
    char buf[MAX*DIGIT+1],ch;  
    int i,j;  
    memset((void*)a,0,sizeof(bignum_t));  
    if (!(is>>buf))   return 0;  
    for (a[0]=strlen(buf),i=a[0]/2-1;i>=0;i--)  
        ch=buf[i],buf[i]=buf[a[0]-1-i],buf[a[0]-1-i]=ch;  
    for (a[0]=(a[0]+DIGIT-1)/DIGIT,j=strlen(buf);j<a[0]*DIGIT;buf[j++]='0');  
    for (i=1;i<=a[0];i++)  
        for (a[i]=0,j=0;j<DIGIT;j++)  
            a[i]=a[i]*10+buf[i*DIGIT-1-j]-'0';  
    for (;!a[a[0]]&&a[0]>1;a[0]--);  
    return 1;  
}  
void write(const bignum_t a,ostream& os=cout){  //高精度除法
    int i,j;  
    for (os<<a[i=a[0]],i--;i;i--)  
        for (j=DEPTH/10;j;j/=10)  
            os<<a[i]/j%10;  
}  
void sub(bignum_t a,const bignum_t b,const int c,const int d){  //高精度除法
    int i,O=b[0]+d;  
    for (i=1+d;i<=O;i++)  
        if ((a[i]-=b[i-d]*c)<0)  
            a[i+1]+=(a[i]-DEPTH+1)/DEPTH,a[i]-=(a[i]-DEPTH+1)/DEPTH*DEPTH;  
    for (;a[i]<0;a[i+1]+=(a[i]-DEPTH+1)/DEPTH,a[i]-=(a[i]-DEPTH+1)/DEPTH*DEPTH,i++);  
    for (;!a[a[0]]&&a[0]>1;a[0]--);  
}  
int comp(const bignum_t a,const int c,const int d,const bignum_t b){  //高精度除法
    int i,t=0,O=-DEPTH*2;  
    if (b[0]-a[0]<d&&c)  
        return 1;  
    for (i=b[0];i>d;i--){  
        t=t*DEPTH+a[i-d]*c-b[i];  
        if (t>0) return 1;  
        if (t<O) return 0;  
    }  
    for (i=d;i;i--){  
        t=t*DEPTH-b[i];  
        if (t>0) return 1;  
        if (t<O) return 0;  
    }  
    return t>0;  
}  

void div(bignum_t c,bignum_t a,const bignum_t b){//高精度除法  
    int h,l,m,i;  
    memset((void*)c,0,sizeof(bignum_t));  
    c[0]=(b[0]<a[0]+1)?(a[0]-b[0]+2):1;  
    for (i=c[0];i;sub(a,b,c[i]=m,i-1),i--)  
        for (h=DEPTH-1,l=0,m=(h+l+1)>>1;h>l;m=(h+l+1)>>1)  
            if (comp(b,m,i-1,a)) h=m-1;  
            else l=m;  
    for (;!c[c[0]]&&c[0]>1;c[0]--);  
    c[0]=c[0]>1?c[0]:1;  
}  
void gj4(){
	bignum_t a,b,c;
	cout<<"被除数a为:";  
    read(a);  
    cout<<"除数b为:";
	read(b);  
    div(c,a,b);  
    cout<<"a/b=";
    write(c);  
    cout<<endl;  
    cout<<"a%b=";
    write(a);  
    cout<<endl; 
} 






void dt1(){//杨辉三角
	cout<<"三角的层数:";
	int n;
	cin>>n; 
    const int m = 2 * n-1;
    int arr[n + 1][m] = { 0 };
    for (int i = 0; i < n; i++)
    {
        arr[i][n - i- 1] = 1;
        arr[i][n + i -1] = 1;
    }
    for (int i = 2; i < n; i++)
    {
        for (int j = n - i + 1; j < n-2+i; j = j + 2)
            arr[i][j] = arr[i - 1][j - 1] + arr[i - 1][j + 1];
    }
    int p;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n - i - 1; j++)
            cout << "    ";
        p = 1;
        for (int j = n - i - 1; p < i + 2; j = j + 2)
        {
            cout << setw(4) << arr[i][j] << "    ";
            p = p + 1;
        }
        cout << endl;
    }
} 
void dt2(){//斐波那契数列 
	int a[10000],b[10000]; 
	string s1="1",s2="1"; 
	char x[1200];
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	int s,n,sum;
	cout<<"你求的是第几个数列:";
    cin>>n;
    for(int j=2;j<n;j++) { 
        memset(a,0,sizeof(a));
        memset(b,0,sizeof(b));
        a[0]=s1.size(); 
        b[0]=s2.size(); 
        for(int i=1;i<=a[0];i++){ 
            a[i]=s1[a[0]-i]-'0';
		} 
        for(int i=1;i<=b[0];i++){ 
            b[i]=s2[b[0]-i]-'0';
		}
        sum=max(a[0],b[0]);
        for(int i=1;i<=sum;i++){ 
            a[i]+=b[i]; 
            a[i+1]+=a[i]/10; 
            a[i]%=10;} 
        sum++; 
        while(!(a[sum])&&(sum>1))sum--;
        s=0;
        for(int i=sum;i>=1;i--)x[s++]=a[i]+'0'; 
        s1=s2; 
        s2=x; 
    } 
    cout<<s2;
}
int main(){
	for(int i=0;i<5;i++){
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ..";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ...";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"             .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"              .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"               .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                ........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                 .......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                  ......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                   .....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                    ....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                     ...";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                      ..";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                       .";system("cls");
	}
	system("cls");
	int zh,mm;//账号,密码
	cout << endl << endl << endl << endl ;
	cout<<"                     -------自定义计算 2.0-------"<<endl<<endl;
	cout<<"                 Hello~ :) 欢迎来到全新的自定义计算2.0----5/23版"<<endl; 
	cout<<"                     请输入账号:";cin>>zh;
	cout<<"                     请输入密码:";cin>>mm;
	int qw;
	bool qe=1;
	if(zh==123456&&mm==456789)qw=1;
	else qw=2;
	while(qw){
		system("cls");
		if(qe==1){	
			for(int i=0;i<ss1.size();i++){
				cout<<ss1[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<ss2.size();i++){
				cout<<ss2[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<ss3.size();i++){
				cout<<ss3[i];
				Sleep(50); 
			} 
			cout<<endl;
			for(int i=0;i<ss4.size();i++){
				cout<<ss4[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<ss5.size();i++){
				cout<<ss5[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<ss6.size();i++){
				cout<<ss6[i];
				Sleep(50);
			} 
			cout<<endl;
			qe=0;
		}
		cout<<ss7<<endl;
		cout<<ss8<<endl;
		cout<<ss9<<endl;
		cout<<ss10<<endl; 
		int xuanxiang;//选项------------------------------------------------------------ 
		cout<<"请选择功能:"; 
		cin>>xuanxiang; 
		if(xuanxiang==1){//高精度 
			system("cls");
			cout<<ss7<<endl;
			cout<<ss1_1<<endl;
			cout<<ss1_2<<endl;
			cout<<ss1_3<<endl;
			cout<<ss1_4<<endl;
			int xuanxiang1;
			cout<<"你的选择:";
			cin>>xuanxiang1; 
			if(xuanxiang1==1){
				system("cls");
				gj1();
				Sleep(500);
			}
			else if(xuanxiang1==2){
				system("cls");
				gj2();
				Sleep(500);
			}
			else if(xuanxiang1==3){
				system("cls");
				gj3();
				Sleep(500);
			}
			else if(xuanxiang1==4){
				system("cls");
				gj4();
				Sleep(500);
			}
		}
		
		
		else if(xuanxiang==2){//递推 
			system("cls");
			cout<<ss7<<endl;
			cout<<ss2_1<<endl;
			cout<<ss2_2<<endl;
			int xuanxiang1;
			cout<<"你的选择:";
			cin>>xuanxiang1; 
			if(xuanxiang1==1){
				system("cls");
				dt1();
				Sleep(500);
			}
			else if(xuanxiang1==2){
				system("cls");
				dt2();
				Sleep(500);
			}
		}
		
		else if(xuanxiang==3){//递归 
			system("cls");
			cout<<ss7<<endl;
			cout<<ss3_1<<endl;
			cout<<ss3_2<<endl;
			int xuanxiang1;
			cout<<"你的选择:";
			cin>>xuanxiang1; 
			if(xuanxiang1==1){
				system("cls");
				dg1();
				gCount=0;
				Sleep(500);
			}
			else if(xuanxiang1==2){
				system("cls");
				dg2();
				cc=0; 
				Sleep(500);
			}
		}
		cout<<endl;
		cout<<"是否退出?"<<endl;
		cout<<"[1]:继续"<<endl;
		cout<<"[0]:退出"<<endl;
		cout<<"你的选择:";
		cin>>qw;
	} 
	return 0;
} 

 

许金夫在2020-05-24 09:31:30追加了内容

更新啦,更新啦!

我终于赶在早高峰更新啦!

今天更新的是模拟!

#include <bits/stdc++.h>
#include<windows.h>
using namespace std;
#define DIGIT   4  
#define DEPTH   10000  
#define MAX     30000  

string p1="好消息,好消息!<自定义计算>更新了!!!";
string p2="<自定义计算2.0>将会有以下更新:";
string p3="[1]:1.0系统中复杂的if将由函数代替";
string p4="[2]:2.0更新将出现多种算法!!!";
string p5="[3]:吐槽一下,希望这次不要再有人盗版我的代码了~";
string p6="好了,话不多说,看一看这次<自定义计算>全家桶将加入那些算法吧~"; 
string ss1="||            ————请选择项目————                               ||";
string ss2="||                 [1]<高精度>                                         ||";
string ss3="||                 [2]<递推>                                           ||";
string ss4="||                 [3]<递归>                                           ||"; 
string ss5="||                 [4]<模拟>                                           ||";


string ss1_1="||                 [1]<高精度>x+y                                      ||";
string ss1_2="||                 [2]<高精度>x-y                                      ||";
string ss1_3="||                 [3]<高精度>x*y                                      ||";
string ss1_4="||                 [4]<高精度>x/y                                      ||";
string ss2_1="||                 [1]<递推>杨辉三角                                   ||";
string ss2_2="||                 [2]<递推>斐波那契                                   ||";
string ss3_1="||                 [1]<递归>八皇后                                     ||";
string ss3_2="||                 [2]<递归>汉诺塔                                     ||"; 
string ss4_1="||                 [1]<模拟>多项式输出                                 ||"; 

string sp1="有一个多项式:f(x)=a[n]*(x^n)+a[n-1]*(x^(n-1))+...+a[1]*x+a[0],其中a[n]!=0.你需要输入n和a[n],即可得出f(x)";
string sp2="八皇后问题--------一个古老而著名的问题,是回溯算法的典型案例。";
string sp3="下面将会输出所有八皇后的选项<此题在题库里无法AC>,所有的'#'代表皇后,为了方便观看,每次输出后将会稍加暂停,请耐心等待~";
 
static int gEightQueen[8] = { 0 }, gCount = 0;//八皇后的定义 
typedef int bignum_t[MAX+1];//高精度除法的定义 


void print()//八皇后
{
	cout<<"第"<<gCount<<"个八皇后排列-----------------------------------"<<endl;
	cout<<"                            =========="<<endl;
    for (int i = 0; i < 8; i++)
    {    
    	cout<<"                            |"; 
        int inner;
        for (inner = 0; inner < gEightQueen[i]; inner++)
            cout << " ";
            cout <<"#";
        for (inner = gEightQueen[i] + 1; inner < 8; inner++)
            cout << " ";
        cout<<"|"; 
        cout << endl;
    }
    cout<<"                            =========="<<endl;
    Sleep(200);
}
int check_pos_valid(int loop, int value){//八皇后
    int index;
    int data;
    for (index = 0; index < loop; index++)
    {
        data = gEightQueen[index];
        if (value == data)
            return 0;
        if ((index + data) == (loop + value))
            return 0;
        if ((index - data) == (loop - value))
            return 0;
    }
    return 1;
}
void eight_queen(int index)//八皇后 
{
	int loop;
    for (loop = 0; loop < 8; loop++)
    {
        if (check_pos_valid(index, loop))
        {
            gEightQueen[index] = loop;
            if (7 == index)
            {
                gCount++, print();
                gEightQueen[index] = 0;
                return;
            }
            eight_queen(index + 1);
            gEightQueen[index] = 0;
        }
    }
}
void dg1(){//八皇后主函数
	for(int i=0;i<sp2.size();i++){
		cout<<sp2[i];
		Sleep(50);
	}
	cout<<endl;
	for(int i=0;i<sp3.size();i++){
		cout<<sp3[i];
		Sleep(50);
	}
	cout<<endl;
	Sleep(100);
	eight_queen(0);
    cout << "总数为=" << gCount << endl;
}  
int cc;//汉诺塔
void Move(int n, char a, char b){//汉诺塔
    printf("第%d次移动 Move %d: Move from %c to %c !\n",++cc,n,a,b);
    Sleep(100); 
}
void Hanoi(int n, char a, char b, char c)//汉诺塔
{
    if (n == 1)
    {
        Move(n, a, c);
    }
    else
    {
        Hanoi(n - 1, a, c, b);
        Move(n, a, c);
        Hanoi(n - 1, b, a, c);
    }
}
void dg2(){//汉诺塔主函数 
	int n=8;
    printf("汉诺塔的层数:\n");
    scanf(" %d",&n);
    Hanoi(n, 'A', 'B', 'C');
} 
void gj1(){//高精度加法
	int a[100005];
	int b[100005];
	int c[100005];
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	memset(c,0,sizeof(c));
	string s1,s2;
	cout<<"加数x:";
    cin>>s1;
    cout<<"加数y:";
	cin>>s2;
    a[0]=s1.size();
    b[0]=s2.size();
    for(int i=1;i<=s1.size();i++)a[i]=int(s1[a[0]-i]-'0');
    for(int i=1;i<=s2.size();i++)b[i]=int(s2[b[0]-i]-'0');
    c[0]=max(a[0],b[0]);
    int jw=0;
    for(int i=1;i<=c[0];i++){
        c[i]=a[i]+b[i]+jw;
        jw=c[i]/10;
        c[i]%=10;
    }
    if(jw==1){
        c[0]++;
        c[c[0]]=jw;
    }
    cout<<"x+y=";
    for(int i=c[0];i>=1;i--){
        cout<<c[i];
    }
} 
void gj2(){//高精度减法 
	string sd,se,sa;  
    int a[100001]{0},b[100001]{0},c[100001]{0},mc,me,mz,n,mo=0; 
	cout<<"减数x:"; 
    cin>>sd;  
    cout<<"减数y:";
    cin>>se; 
	mc=sd.size();  
    me=se.size();  
    if(mc<me||mc==me&&sd<se){sa=sd;sd=se;se=sa;n=mc;mc=me;me=n;mo=-1;}   
    for(int i=1;i<=mc;i++) a[i]=sd[mc-i]-'0';  
    for(int i=1;i<=me;i++) b[i]=se[me-i]-'0';  
    int i=1,o=0;  
    while(i<=mc||i<=me)  
    {  
        if(a[i]<b[i]){a[i+1]--;a[i]+=10;}  
        c[i]=a[i]-b[i];  
        i++;  
    }  
    mz=i;while(c[mz]==0&&mz>1)mz--; 
	cout<<"x-y="; 
    if(mo==-1) cout<<"-";  
    for(int i=mz;i>=1;i--) cout<<c[i];  
}
void gj3(){//高精度乘法 
	string sa="",sb="",st="";
	int la=0,lb=0,lc=0,tla=0,tlb=0,t=0;
	bool isuselesszero=true;
	vector <int> a,b,c;
	cout<<"乘数x:";
	cin>>sa;
	cout<<"乘数y:";
	cin>>sb;
    if(sa[0]=='0' || sb[0]=='0') {
		cout<<0; 
		return ;
	}
    la=sa.length(); lb=sb.length();
    if(la>lb){
		swap(sa,sb); 
		la=sa.length(); 
		lb=sb.length();
	}
    lc=max(la,lb); 
	tla=la; 
	tlb=lb;
    reverse(sa.begin(),sa.end()); 
	reverse(sb.begin(),sb.end());
    while(tla<lc){
		sa+='0'; 
		tla=sa.length();
	}
    while(tlb<lc){
		sb+='0'; 
		tlb=sb.length();
	}
    for(int i=0;i<1000000;i++) c.push_back(0);
    for(int i=0;i<lc;i++){
		a.push_back((sa[i]-'0')); 
		b.push_back((sb[i]-'0'));
	}
    for(int i=0;i<lb;i++){
        for(int j=0;j<la;j++){
            c[i+j]+=a[j]*b[i];
            if(c[i+j]>=10){
                c[i+j+1]+=c[i+j]/10;
                c[i+j]%=10;
            }
        }
    }
    reverse(c.begin(),c.end());
    cout<<"x*y=";
    for(int i=0;i<1000000;i++){
        if(isuselesszero&&c[i]==0) continue;
        if(c[i]!=0) isuselesszero=false;
        if(c[i]<10) cout<<c[i];
        else{
            c[i-1]=c[i]/10;
            c[i]%=10;
            cout<<c[i];
        }
    }
    return ;
}







int read(bignum_t a,istream& is=cin){  //高精度除法
    char buf[MAX*DIGIT+1],ch;  
    int i,j;  
    memset((void*)a,0,sizeof(bignum_t));  
    if (!(is>>buf))   return 0;  
    for (a[0]=strlen(buf),i=a[0]/2-1;i>=0;i--)  
        ch=buf[i],buf[i]=buf[a[0]-1-i],buf[a[0]-1-i]=ch;  
    for (a[0]=(a[0]+DIGIT-1)/DIGIT,j=strlen(buf);j<a[0]*DIGIT;buf[j++]='0');  
    for (i=1;i<=a[0];i++)  
        for (a[i]=0,j=0;j<DIGIT;j++)  
            a[i]=a[i]*10+buf[i*DIGIT-1-j]-'0';  
    for (;!a[a[0]]&&a[0]>1;a[0]--);  
    return 1;  
}  
void write(const bignum_t a,ostream& os=cout){  //高精度除法
    int i,j;  
    for (os<<a[i=a[0]],i--;i;i--)  
        for (j=DEPTH/10;j;j/=10)  
            os<<a[i]/j%10;  
}  
void sub(bignum_t a,const bignum_t b,const int c,const int d){  //高精度除法
    int i,O=b[0]+d;  
    for (i=1+d;i<=O;i++)  
        if ((a[i]-=b[i-d]*c)<0)  
            a[i+1]+=(a[i]-DEPTH+1)/DEPTH,a[i]-=(a[i]-DEPTH+1)/DEPTH*DEPTH;  
    for (;a[i]<0;a[i+1]+=(a[i]-DEPTH+1)/DEPTH,a[i]-=(a[i]-DEPTH+1)/DEPTH*DEPTH,i++);  
    for (;!a[a[0]]&&a[0]>1;a[0]--);  
}  
int comp(const bignum_t a,const int c,const int d,const bignum_t b){  //高精度除法
    int i,t=0,O=-DEPTH*2;  
    if (b[0]-a[0]<d&&c)  
        return 1;  
    for (i=b[0];i>d;i--){  
        t=t*DEPTH+a[i-d]*c-b[i];  
        if (t>0) return 1;  
        if (t<O) return 0;  
    }  
    for (i=d;i;i--){  
        t=t*DEPTH-b[i];  
        if (t>0) return 1;  
        if (t<O) return 0;  
    }  
    return t>0;  
}  

void div(bignum_t c,bignum_t a,const bignum_t b){//高精度除法  
    int h,l,m,i;  
    memset((void*)c,0,sizeof(bignum_t));  
    c[0]=(b[0]<a[0]+1)?(a[0]-b[0]+2):1;  
    for (i=c[0];i;sub(a,b,c[i]=m,i-1),i--)  
        for (h=DEPTH-1,l=0,m=(h+l+1)>>1;h>l;m=(h+l+1)>>1)  
            if (comp(b,m,i-1,a)) h=m-1;  
            else l=m;  
    for (;!c[c[0]]&&c[0]>1;c[0]--);  
    c[0]=c[0]>1?c[0]:1;  
}  
void gj4(){
	bignum_t a,b,c;
	cout<<"被除数a为:";  
    read(a);  
    cout<<"除数b为:";
	read(b);  
    div(c,a,b);  
    cout<<"a/b=";
    write(c);  
    cout<<endl;  
    cout<<"a%b=";
    write(a);  
    cout<<endl; 
} 






void dt1(){//杨辉三角
	cout<<"三角的层数:";
	int n;
	cin>>n; 
    const int m = 2 * n-1;
    int arr[n + 1][m] = { 0 };
    for (int i = 0; i < n; i++)
    {
        arr[i][n - i- 1] = 1;
        arr[i][n + i -1] = 1;
    }
    for (int i = 2; i < n; i++)
    {
        for (int j = n - i + 1; j < n-2+i; j = j + 2)
            arr[i][j] = arr[i - 1][j - 1] + arr[i - 1][j + 1];
    }
    int p;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n - i - 1; j++)
            cout << "    ";
        p = 1;
        for (int j = n - i - 1; p < i + 2; j = j + 2)
        {
            cout << setw(4) << arr[i][j] << "    ";
            p = p + 1;
        }
        cout << endl;
    }
} 
void dt2(){//斐波那契数列 
	int a[10000],b[10000]; 
	string s1="1",s2="1"; 
	char x[1200];
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	int s,n,sum;
	cout<<"你求的是第几个数列:";
    cin>>n;
    for(int j=2;j<n;j++) { 
        memset(a,0,sizeof(a));
        memset(b,0,sizeof(b));
        a[0]=s1.size(); 
        b[0]=s2.size(); 
        for(int i=1;i<=a[0];i++){ 
            a[i]=s1[a[0]-i]-'0';
		} 
        for(int i=1;i<=b[0];i++){ 
            b[i]=s2[b[0]-i]-'0';
		}
        sum=max(a[0],b[0]);
        for(int i=1;i<=sum;i++){ 
            a[i]+=b[i]; 
            a[i+1]+=a[i]/10; 
            a[i]%=10;} 
        sum++; 
        while(!(a[sum])&&(sum>1))sum--;
        s=0;
        for(int i=sum;i>=1;i--)x[s++]=a[i]+'0'; 
        s1=s2; 
        s2=x; 
    } 
    cout<<s2;
}
void moni1(){
	int t[101];
	memset(t,-1,sizeof(t));
	for(int i=0;i<sp1.size();i++){
		cout<<sp1[i];
		Sleep(50);
	}
	int n, p;
    bool f = true;
    cout<<endl<<"n=";
    cin >> n;
    p = n;
    for(int i=1; i<=n+1; i++) {
    	cout<<"t["<<i<<"]=";
		cin>>t[i];
	}
	cout<<"f(x)=";
    for(int i=1; i<=n+1; i++) {
        if(t[i]==0) {
            p --;
            continue;
        }
        if(t[i]<0) cout << "-";
        if(t[i]>0 && !f) {
            cout << "+";
        }
        if(abs(t[i])!=1 || p==0) cout << abs(t[i]);
        if(p>0) cout << "x";
        if(p>1) cout << "^" << p;
        p --;
        f = false;
    }
}
int main(){
	for(int i=0;i<5;i++){
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ..";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ...";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"             .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"              .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"               .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                ........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                 .......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                  ......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                   .....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                    ....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                     ...";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                      ..";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                       .";system("cls");
	}
	system("cls");
	int zh,mm;//账号,密码
	cout << endl << endl << endl << endl ;
	cout<<"                     -------自定义计算 2.0-------"<<endl<<endl;
	cout<<"                 Hello~ :) 欢迎来到全新的自定义计算2.0----5/23版"<<endl; 
	cout<<"                     请输入账号:";cin>>zh;
	cout<<"                     请输入密码:";cin>>mm;
	int qw;
	bool qe=1;
	if(zh==123456&&mm==456789)qw=1;
	else qw=2;
	while(qw==2){
		if(zh!=123456)cout<<"                     账号不存在"<<endl; 
		else if(mm!=456789)cout<<"                     密码输入错误"<<endl;
		cout<<"                     请再次输入账号:";cin>>zh;
		cout<<"                     请再次输入密码:";cin>>mm;
		if(zh==123456&&mm==456789)qw=1;
		else qw=2; 
	} 
	while(qw==1){
		system("cls");
		if(qe==1){	
			for(int i=0;i<p1.size();i++){
				cout<<p1[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<p2.size();i++){
				cout<<p2[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<p3.size();i++){
				cout<<p3[i];
				Sleep(50); 
			} 
			cout<<endl;
			for(int i=0;i<p4.size();i++){
				cout<<p4[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<p5.size();i++){
				cout<<p5[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<p6.size();i++){
				cout<<p6[i];
				Sleep(50);
			} 
			cout<<endl;
			qe=0;
		}
		cout<<ss1<<endl;
		cout<<ss2<<endl;
		cout<<ss3<<endl;
		cout<<ss4<<endl; 
		cout<<ss5<<endl;
		int xuanxiang;//选项------------------------------------------------------------ 
		cout<<"请选择功能:"; 
		cin>>xuanxiang; 
		if(xuanxiang==1){//高精度 
			system("cls");
			cout<<ss1<<endl;
			cout<<ss1_1<<endl;
			cout<<ss1_2<<endl;
			cout<<ss1_3<<endl;
			cout<<ss1_4<<endl;
			int xuanxiang1;
			cout<<"你的选择:";
			cin>>xuanxiang1; 
			if(xuanxiang1==1){
				system("cls");
				gj1();
				Sleep(500);
			}
			else if(xuanxiang1==2){
				system("cls");
				gj2();
				Sleep(500);
			}
			else if(xuanxiang1==3){
				system("cls");
				gj3();
				Sleep(500);
			}
			else if(xuanxiang1==4){
				system("cls");
				gj4();
				Sleep(500);
			}
		}
		
		
		else if(xuanxiang==2){//递推 
			system("cls");
			cout<<ss1<<endl;
			cout<<ss2_1<<endl;
			cout<<ss2_2<<endl;
			int xuanxiang1;
			cout<<"你的选择:";
			cin>>xuanxiang1; 
			if(xuanxiang1==1){
				system("cls");
				dt1();
				Sleep(500);
			}
			else if(xuanxiang1==2){
				system("cls");
				dt2();
				Sleep(500);
			}
		}
		
		else if(xuanxiang==3){//递归 
			system("cls");
			cout<<ss1<<endl;
			cout<<ss3_1<<endl;
			cout<<ss3_2<<endl;
			int xuanxiang1;
			cout<<"你的选择:";
			cin>>xuanxiang1; 
			if(xuanxiang1==1){
				system("cls");
				dg1();
				gCount=0;
				Sleep(500);
			}
			else if(xuanxiang1==2){
				system("cls");
				dg2();
				cc=0; 
				Sleep(500);
			}
		}
		else if(xuanxiang==4){//模拟 
			system("cls");
			cout<<ss1<<endl;
			cout<<ss4_1<<endl;
			int xuanxiang1;
			cout<<"你的选择:";
			cin>>xuanxiang1; 
			if(xuanxiang1==1){
				system("cls");
				moni1();
				Sleep(500);
			}
		}
		else if(xuanxiang==5){
			
		} 
		
		cout<<endl;
		cout<<"是否退出?"<<endl;
		cout<<"[1]:继续"<<endl;
		cout<<"[0]:退出"<<endl;
		cout<<"你的选择:";
		cin>>qw;
	} 
	cout<<"see you next time~"<<endl;
	cout << "欢迎下次登录 "<< (char)(92) <<" ^-^ / " << endl ; 
	return 0;
} 

喜欢就点个赞吧~

许金夫在2020-05-24 18:33:22追加了内容

更新~

依然是模拟~

#include <bits/stdc++.h>
#include<windows.h>
using namespace std;
#define DIGIT   4  
#define DEPTH   10000  
#define MAX     30000  

string p1="好消息,好消息!<自定义计算>更新了!!!";
string p2="<自定义计算2.0>将会有以下更新:";
string p3="[1]:1.0系统中复杂的if将由函数代替";
string p4="[2]:2.0更新将出现多种算法!!!";
string p5="[3]:吐槽一下,希望这次不要再有人盗版我的代码了~";
string p6="好了,话不多说,看一看这次<自定义计算>全家桶将加入那些算法吧~"; 
string ss1="||            ————请选择项目————                               ||";
string ss2="||                 [1]<高精度>                                         ||";
string ss3="||                 [2]<递推>                                           ||";
string ss4="||                 [3]<递归>                                           ||"; 
string ss5="||                 [4]<模拟>                                           ||";


string ss1_1="||                 [1]<高精度>x+y                                      ||";
string ss1_2="||                 [2]<高精度>x-y                                      ||";
string ss1_3="||                 [3]<高精度>x*y                                      ||";
string ss1_4="||                 [4]<高精度>x/y                                      ||";
string ss2_1="||                 [1]<递推>杨辉三角                                   ||";
string ss2_2="||                 [2]<递推>斐波那契                                   ||";
string ss3_1="||                 [1]<递归>八皇后                                     ||";
string ss3_2="||                 [2]<递归>汉诺塔                                     ||"; 
string ss4_1="||                 [1]<模拟>多项式输出                                 ||"; 
string ss4_2="||                 [2]<模拟>补码                                       ||"; 



string sp1="有一个多项式:f(x)=a[n]*(x^n)+a[n-1]*(x^(n-1))+...+a[1]*x+a[0],其中a[n]!=0.你需要输入n和a[n],即可得出f(x)";
string sp2="八皇后问题--------一个古老而著名的问题,是回溯算法的典型案例。";
string sp3="下面将会输出所有八皇后的选项<此题在题库里无法AC>,所有的'#'代表皇后,为了方便观看,每次输出后将会稍加暂停,请耐心等待~";
 
static int gEightQueen[8] = { 0 }, gCount = 0;//八皇后的定义 
typedef int bignum_t[MAX+1];//高精度除法的定义 


void print()//八皇后
{
	cout<<"第"<<gCount<<"个八皇后排列-----------------------------------"<<endl;
	cout<<"                            =========="<<endl;
    for (int i = 0; i < 8; i++)
    {    
    	cout<<"                            |"; 
        int inner;
        for (inner = 0; inner < gEightQueen[i]; inner++)
            cout << " ";
            cout <<"#";
        for (inner = gEightQueen[i] + 1; inner < 8; inner++)
            cout << " ";
        cout<<"|"; 
        cout << endl;
    }
    cout<<"                            =========="<<endl;
    Sleep(200);
}
int check_pos_valid(int loop, int value){//八皇后
    int index;
    int data;
    for (index = 0; index < loop; index++)
    {
        data = gEightQueen[index];
        if (value == data)
            return 0;
        if ((index + data) == (loop + value))
            return 0;
        if ((index - data) == (loop - value))
            return 0;
    }
    return 1;
}
void eight_queen(int index)//八皇后 
{
	int loop;
    for (loop = 0; loop < 8; loop++)
    {
        if (check_pos_valid(index, loop))
        {
            gEightQueen[index] = loop;
            if (7 == index)
            {
                gCount++, print();
                gEightQueen[index] = 0;
                return;
            }
            eight_queen(index + 1);
            gEightQueen[index] = 0;
        }
    }
}
void dg1(){//八皇后主函数
	for(int i=0;i<sp2.size();i++){
		cout<<sp2[i];
		Sleep(50);
	}
	cout<<endl;
	for(int i=0;i<sp3.size();i++){
		cout<<sp3[i];
		Sleep(50);
	}
	cout<<endl;
	Sleep(100);
	eight_queen(0);
    cout << "总数为=" << gCount << endl;
}  
int cc;//汉诺塔
void Move(int n, char a, char b){//汉诺塔
    printf("第%d次移动 Move %d: Move from %c to %c !\n",++cc,n,a,b);
    Sleep(100); 
}
void Hanoi(int n, char a, char b, char c)//汉诺塔
{
    if (n == 1)
    {
        Move(n, a, c);
    }
    else
    {
        Hanoi(n - 1, a, c, b);
        Move(n, a, c);
        Hanoi(n - 1, b, a, c);
    }
}
void dg2(){//汉诺塔主函数 
	int n=8;
    printf("汉诺塔的层数:\n");
    scanf(" %d",&n);
    Hanoi(n, 'A', 'B', 'C');
} 
void gj1(){//高精度加法
	int a[100005];
	int b[100005];
	int c[100005];
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	memset(c,0,sizeof(c));
	string s1,s2;
	cout<<"加数x:";
    cin>>s1;
    cout<<"加数y:";
	cin>>s2;
    a[0]=s1.size();
    b[0]=s2.size();
    for(int i=1;i<=s1.size();i++)a[i]=int(s1[a[0]-i]-'0');
    for(int i=1;i<=s2.size();i++)b[i]=int(s2[b[0]-i]-'0');
    c[0]=max(a[0],b[0]);
    int jw=0;
    for(int i=1;i<=c[0];i++){
        c[i]=a[i]+b[i]+jw;
        jw=c[i]/10;
        c[i]%=10;
    }
    if(jw==1){
        c[0]++;
        c[c[0]]=jw;
    }
    cout<<"x+y=";
    for(int i=c[0];i>=1;i--){
        cout<<c[i];
    }
} 
void gj2(){//高精度减法 
	string sd,se,sa;  
    int a[100001]{0},b[100001]{0},c[100001]{0},mc,me,mz,n,mo=0; 
	cout<<"减数x:"; 
    cin>>sd;  
    cout<<"减数y:";
    cin>>se; 
	mc=sd.size();  
    me=se.size();  
    if(mc<me||mc==me&&sd<se){sa=sd;sd=se;se=sa;n=mc;mc=me;me=n;mo=-1;}   
    for(int i=1;i<=mc;i++) a[i]=sd[mc-i]-'0';  
    for(int i=1;i<=me;i++) b[i]=se[me-i]-'0';  
    int i=1,o=0;  
    while(i<=mc||i<=me)  
    {  
        if(a[i]<b[i]){a[i+1]--;a[i]+=10;}  
        c[i]=a[i]-b[i];  
        i++;  
    }  
    mz=i;while(c[mz]==0&&mz>1)mz--; 
	cout<<"x-y="; 
    if(mo==-1) cout<<"-";  
    for(int i=mz;i>=1;i--) cout<<c[i];  
}
void gj3(){//高精度乘法 
	string sa="",sb="",st="";
	int la=0,lb=0,lc=0,tla=0,tlb=0,t=0;
	bool isuselesszero=true;
	vector <int> a,b,c;
	cout<<"乘数x:";
	cin>>sa;
	cout<<"乘数y:";
	cin>>sb;
    if(sa[0]=='0' || sb[0]=='0') {
		cout<<0; 
		return ;
	}
    la=sa.length(); lb=sb.length();
    if(la>lb){
		swap(sa,sb); 
		la=sa.length(); 
		lb=sb.length();
	}
    lc=max(la,lb); 
	tla=la; 
	tlb=lb;
    reverse(sa.begin(),sa.end()); 
	reverse(sb.begin(),sb.end());
    while(tla<lc){
		sa+='0'; 
		tla=sa.length();
	}
    while(tlb<lc){
		sb+='0'; 
		tlb=sb.length();
	}
    for(int i=0;i<1000000;i++) c.push_back(0);
    for(int i=0;i<lc;i++){
		a.push_back((sa[i]-'0')); 
		b.push_back((sb[i]-'0'));
	}
    for(int i=0;i<lb;i++){
        for(int j=0;j<la;j++){
            c[i+j]+=a[j]*b[i];
            if(c[i+j]>=10){
                c[i+j+1]+=c[i+j]/10;
                c[i+j]%=10;
            }
        }
    }
    reverse(c.begin(),c.end());
    cout<<"x*y=";
    for(int i=0;i<1000000;i++){
        if(isuselesszero&&c[i]==0) continue;
        if(c[i]!=0) isuselesszero=false;
        if(c[i]<10) cout<<c[i];
        else{
            c[i-1]=c[i]/10;
            c[i]%=10;
            cout<<c[i];
        }
    }
    return ;
}







int read(bignum_t a,istream& is=cin){  //高精度除法
    char buf[MAX*DIGIT+1],ch;  
    int i,j;  
    memset((void*)a,0,sizeof(bignum_t));  
    if (!(is>>buf))   return 0;  
    for (a[0]=strlen(buf),i=a[0]/2-1;i>=0;i--)  
        ch=buf[i],buf[i]=buf[a[0]-1-i],buf[a[0]-1-i]=ch;  
    for (a[0]=(a[0]+DIGIT-1)/DIGIT,j=strlen(buf);j<a[0]*DIGIT;buf[j++]='0');  
    for (i=1;i<=a[0];i++)  
        for (a[i]=0,j=0;j<DIGIT;j++)  
            a[i]=a[i]*10+buf[i*DIGIT-1-j]-'0';  
    for (;!a[a[0]]&&a[0]>1;a[0]--);  
    return 1;  
}  
void write(const bignum_t a,ostream& os=cout){  //高精度除法
    int i,j;  
    for (os<<a[i=a[0]],i--;i;i--)  
        for (j=DEPTH/10;j;j/=10)  
            os<<a[i]/j%10;  
}  
void sub(bignum_t a,const bignum_t b,const int c,const int d){  //高精度除法
    int i,O=b[0]+d;  
    for (i=1+d;i<=O;i++)  
        if ((a[i]-=b[i-d]*c)<0)  
            a[i+1]+=(a[i]-DEPTH+1)/DEPTH,a[i]-=(a[i]-DEPTH+1)/DEPTH*DEPTH;  
    for (;a[i]<0;a[i+1]+=(a[i]-DEPTH+1)/DEPTH,a[i]-=(a[i]-DEPTH+1)/DEPTH*DEPTH,i++);  
    for (;!a[a[0]]&&a[0]>1;a[0]--);  
}  
int comp(const bignum_t a,const int c,const int d,const bignum_t b){  //高精度除法
    int i,t=0,O=-DEPTH*2;  
    if (b[0]-a[0]<d&&c)  
        return 1;  
    for (i=b[0];i>d;i--){  
        t=t*DEPTH+a[i-d]*c-b[i];  
        if (t>0) return 1;  
        if (t<O) return 0;  
    }  
    for (i=d;i;i--){  
        t=t*DEPTH-b[i];  
        if (t>0) return 1;  
        if (t<O) return 0;  
    }  
    return t>0;  
}  

void div(bignum_t c,bignum_t a,const bignum_t b){//高精度除法  
    int h,l,m,i;  
    memset((void*)c,0,sizeof(bignum_t));  
    c[0]=(b[0]<a[0]+1)?(a[0]-b[0]+2):1;  
    for (i=c[0];i;sub(a,b,c[i]=m,i-1),i--)  
        for (h=DEPTH-1,l=0,m=(h+l+1)>>1;h>l;m=(h+l+1)>>1)  
            if (comp(b,m,i-1,a)) h=m-1;  
            else l=m;  
    for (;!c[c[0]]&&c[0]>1;c[0]--);  
    c[0]=c[0]>1?c[0]:1;  
}  
void gj4(){
	bignum_t a,b,c;
	cout<<"被除数a为:";  
    read(a);  
    cout<<"除数b为:";
	read(b);  
    div(c,a,b);  
    cout<<"a/b=";
    write(c);  
    cout<<endl;  
    cout<<"a%b=";
    write(a);  
    cout<<endl; 
} 






void dt1(){//杨辉三角
	cout<<"三角的层数:";
	int n;
	cin>>n; 
    const int m = 2 * n-1;
    int arr[n + 1][m] = { 0 };
    for (int i = 0; i < n; i++)
    {
        arr[i][n - i- 1] = 1;
        arr[i][n + i -1] = 1;
    }
    for (int i = 2; i < n; i++)
    {
        for (int j = n - i + 1; j < n-2+i; j = j + 2)
            arr[i][j] = arr[i - 1][j - 1] + arr[i - 1][j + 1];
    }
    int p;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n - i - 1; j++)
            cout << "    ";
        p = 1;
        for (int j = n - i - 1; p < i + 2; j = j + 2)
        {
            cout << setw(4) << arr[i][j] << "    ";
            p = p + 1;
        }
        cout << endl;
    }
} 
void dt2(){//斐波那契数列 
	int a[10000],b[10000]; 
	string s1="1",s2="1"; 
	char x[1200];
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	int s,n,sum;
	cout<<"你求的是第几个数列:";
    cin>>n;
    for(int j=2;j<n;j++) { 
        memset(a,0,sizeof(a));
        memset(b,0,sizeof(b));
        a[0]=s1.size(); 
        b[0]=s2.size(); 
        for(int i=1;i<=a[0];i++){ 
            a[i]=s1[a[0]-i]-'0';
		} 
        for(int i=1;i<=b[0];i++){ 
            b[i]=s2[b[0]-i]-'0';
		}
        sum=max(a[0],b[0]);
        for(int i=1;i<=sum;i++){ 
            a[i]+=b[i]; 
            a[i+1]+=a[i]/10; 
            a[i]%=10;} 
        sum++; 
        while(!(a[sum])&&(sum>1))sum--;
        s=0;
        for(int i=sum;i>=1;i--)x[s++]=a[i]+'0'; 
        s1=s2; 
        s2=x; 
    } 
    cout<<s2;
}
void moni1(){
	int t[101];
	memset(t,-1,sizeof(t));
	for(int i=0;i<sp1.size();i++){
		cout<<sp1[i];
		Sleep(50);
	}
	int n, p;
    bool f = true;
    cout<<endl<<"n=";
    cin >> n;
    p = n;
    for(int i=1; i<=n+1; i++) {
    	cout<<"t["<<i<<"]=";
		cin>>t[i];
	}
	cout<<"f(x)=";
    for(int i=1; i<=n+1; i++) {
        if(t[i]==0) {
            p --;
            continue;
        }
        if(t[i]<0) cout << "-";
        if(t[i]>0 && !f) {
            cout << "+";
        }
        if(abs(t[i])!=1 || p==0) cout << abs(t[i]);
        if(p>0) cout << "x";
        if(p>1) cout << "^" << p;
        p --;
        f = false;
    }
}
void moni2(){
	cout<<"输入一个正整数二进制:";
	string s;
    cin >> s;
    cout<<s<<"的相反数的八位二进制补码=";
    int n = 7 - s.size();
    for(int i=1; i<=n; i++) {
        s = '0' + s;
    }
    for(int i=0; i<s.size(); i++) {
        if(s[i]=='0') s[i] = '1';
        else s[i] = '0';
    }
    for(int i=s.size()-1; i>=0; i--) {
        if(s[i]=='0') {
            s[i] = '1';
            break;
        }
        s[i] = '0';
    }
    cout << 1 << s;
}
int main(){
	for(int i=0;i<5;i++){
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ..";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ...";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            ........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"            .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"             .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"              .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"               .........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                ........";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                 .......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                  ......";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                   .....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                    ....";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                     ...";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                      ..";system("cls");
		for(int i=0;i<1;i++)cout<<endl<<endl<<endl<<endl<<endl<<"                       .";system("cls");
	}
	system("cls");
	int zh,mm;//账号,密码
	cout << endl << endl << endl << endl ;
	cout<<"                     -------自定义计算 2.0-------"<<endl<<endl;
	cout<<"                 Hello~ :) 欢迎来到全新的自定义计算2.0----5/23版"<<endl; 
	cout<<"                     请输入账号:";cin>>zh;
	cout<<"                     请输入密码:";cin>>mm;
	int qw;
	bool qe=1;
	if(zh==123456&&mm==456789)qw=1;
	else qw=2;
	while(qw==2){
		if(zh!=123456)cout<<"                     账号不存在"<<endl; 
		else if(mm!=456789)cout<<"                     密码输入错误"<<endl;
		cout<<"                     请再次输入账号:";cin>>zh;
		cout<<"                     请再次输入密码:";cin>>mm;
		if(zh==123456&&mm==456789)qw=1;
		else qw=2; 
	} 
	while(qw==1){
		system("cls");
		if(qe==1){	
			for(int i=0;i<p1.size();i++){
				cout<<p1[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<p2.size();i++){
				cout<<p2[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<p3.size();i++){
				cout<<p3[i];
				Sleep(50); 
			} 
			cout<<endl;
			for(int i=0;i<p4.size();i++){
				cout<<p4[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<p5.size();i++){
				cout<<p5[i];
				Sleep(50);
			} 
			cout<<endl;
			for(int i=0;i<p6.size();i++){
				cout<<p6[i];
				Sleep(50);
			} 
			cout<<endl;
			qe=0;
		}
		cout<<ss1<<endl;
		cout<<ss2<<endl;
		cout<<ss3<<endl;
		cout<<ss4<<endl; 
		cout<<ss5<<endl;
		int xuanxiang;//选项------------------------------------------------------------ 
		cout<<"请选择功能:"; 
		cin>>xuanxiang; 
		if(xuanxiang==1){//高精度 
			system("cls");
			cout<<ss1<<endl;
			cout<<ss1_1<<endl;
			cout<<ss1_2<<endl;
			cout<<ss1_3<<endl;
			cout<<ss1_4<<endl;
			int xuanxiang1;
			cout<<"你的选择:";
			cin>>xuanxiang1; 
			if(xuanxiang1==1){
				system("cls");
				gj1();
				Sleep(500);
			}
			else if(xuanxiang1==2){
				system("cls");
				gj2();
				Sleep(500);
			}
			else if(xuanxiang1==3){
				system("cls");
				gj3();
				Sleep(500);
			}
			else if(xuanxiang1==4){
				system("cls");
				gj4();
				Sleep(500);
			}
		}
		
		
		else if(xuanxiang==2){//递推 
			system("cls");
			cout<<ss1<<endl;
			cout<<ss2_1<<endl;
			cout<<ss2_2<<endl;
			int xuanxiang1;
			cout<<"你的选择:";
			cin>>xuanxiang1; 
			if(xuanxiang1==1){
				system("cls");
				dt1();
				Sleep(500);
			}
			else if(xuanxiang1==2){
				system("cls");
				dt2();
				Sleep(500);
			}
		}
		
		else if(xuanxiang==3){//递归 
			system("cls");
			cout<<ss1<<endl;
			cout<<ss3_1<<endl;
			cout<<ss3_2<<endl;
			int xuanxiang1;
			cout<<"你的选择:";
			cin>>xuanxiang1; 
			if(xuanxiang1==1){
				system("cls");
				dg1();
				gCount=0;
				Sleep(500);
			}
			else if(xuanxiang1==2){
				system("cls");
				dg2();
				cc=0; 
				Sleep(500);
			}
		}
		else if(xuanxiang==4){//模拟 
			system("cls");
			cout<<ss1<<endl;
			cout<<ss4_1<<endl;
			cout<<ss4_2<<endl;
			int xuanxiang1;
			cout<<"你的选择:";
			cin>>xuanxiang1; 
			if(xuanxiang1==1){
				system("cls");
				moni1();
				Sleep(500);
			}
			else if(xuanxiang1==2){
				system("cls");
				moni2();
				Sleep(500);
			}
		}
		else if(xuanxiang==5){
			
		} 
		
		cout<<endl;
		cout<<"是否退出?"<<endl;
		cout<<"[1]:继续"<<endl;
		cout<<"[0]:退出"<<endl;
		cout<<"你的选择:";
		cin>>qw;
	} 
	cout<<"see you next time~"<<endl;
	cout << "欢迎下次登录 "<< (char)(92) <<" ^-^ / " << endl ; 
	return 0;
} 

一定要点赞哦~


0
0
0
0
0
余彦文
余彦文
初级光能
初级光能

更新的越来越棒呢\(^o^)八(^o^)人(^o^)/

0
徐子宸
徐子宸
中级天翼
中级天翼

腻害!

徐子宸在2020-05-23 20:09:51追加了内容

报错。。。。。。

0
王子逸
王子逸
新手天翼
新手天翼

可以,能不能把运算过程写出来

0
邓涵睿
邓涵睿
中级天翼
中级天翼

厉害👍(。^▽^),我刚吃完火锅到家,巴适!

我要回答