自定义计算1.0

· · 个人记录

#include<iostream>
#include<cstdio>
#include<cmath>
#include<windows.h>
using namespace std;
void print(const char a[],int b){
    int s=strlen(a);
    for(int i=0;i<s;i++){
        printf("%c",a[i]);
        Sleep(b);
    }
}
void Initialize(){
    system("color f0");
    RECT rect; 
    HWND hwnd=GetForegroundWindow();
    GetWindowRect(hwnd,&rect); 
    MoveWindow(hwnd,0,0,rect.right-rect.left,rect.bottom-rect.top,TRUE);
    system("mode con cols=90 lines=30");
}
void cursor(bool a){
    HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_CURSOR_INFO CursorInfo;
    GetConsoleCursorInfo(handle, &CursorInfo);
    CursorInfo.bVisible = a;
    SetConsoleCursorInfo(handle, &CursorInfo);
}
void gotoxy(int x,int y){
    COORD pos;
    pos.X=2*x;
    pos.Y=y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
void welcome(){
    Initialize();
    cursor(0);
    gotoxy(15,11);print("自定义计算-1.0<常规计算>",75);
    gotoxy(22,12);print("by 夜阑",75);
    Sleep(600);system("cls");
    Sleep(500);
    system("cls"); 
    gotoxy(16,11);print("[夜阑]的个人博客luogu",50);
    gotoxy(7,12);print("https://www.luogu.com.cn/blog/34010420060215701X/",50);
    Sleep(500);
    gotoxy(17,13);print("F键进入个人博客",50);
    Sleep(600);
    gotoxy(15,11);print("请输入任意键继续... ...",50);
    char k=cin.get();
    if(k=='F')system("start https://www.luogu.com.cn/blog/34010420060215701X/");
    system("cls");
    return;
}
int main()
{
    welcome(); 

    int qw=1 ;
    while(qw==1)
    {
        system("cls");
        int qe=1;
        if(qe==1)
        {
            int w=1;
            system("cls");
            cout << endl << endl << endl << endl ;
            gotoxy(16,11);print("------- 自定义计算 2.0 -------",50);
            gotoxy(16,11);print("           Hello   :)         ",50); 
            while(w==1)
            {
                system("cls"); 
                if(1)
                {
                    system("cls"); 
                    cout << "||            ————请选择项目————                               ||" << endl ;
                    cout << "||                 1.选择a,输出'x + y'                                 ||"<< endl; 
                    cout << "||                 2.选择b,输出'x - y'                                 ||"<< endl;
                    cout << "||                 3.选择c,输出'x * y'                                 ||"<< endl;
                    cout << "||                 4.选择d,输出'x / y'                                 ||"<< endl;
                    cout << "||            ————进入高级计算————                             ||"<< endl; 
                    cout << "||                 5.选择e,进入循环系统                                ||"<< endl;
                    cout << "||                 6.选择f,进入保留小数                                ||"<< endl;
                    cout << "||                 7.选择g,使用几何计算                                ||"<< endl;
                    cout << "||                 8.选择h,使用乘方计算                                ||"<< endl;
                    cout << "||                 9.选择i,二进制十进制                                ||"<< endl ;
                    cout << "||                 10.选择j,分解质因数                                 ||"<< endl ;
                    cout << "||                 11选择k,退出计算程序                                ||"<< endl ;
                    cout << "||     [公告]:循环系统的分行数字循环因计算过大而故障,敬请修复         ||" << endl ; 
                    cout << "                                     请选择功能:" ;
                    char a ;
                    cin >> a ;
                    if(a=='a')
                    {
                        system("cls"); 
                        cout << "你已选择加法功能,请选择加法类型:" << endl ;
                        cout << "[1]:普通加法" << endl ;
                        cout << "[2]:绝对值加法" << endl ;
                        int b ;
                        cout << "加法类型为:" << endl ; 
                        cin >> b ;
                        if(b==1)
                        {
                            cout << "你已选择普通加法,请输入x,y:" << endl ;
                            int x , y ;
                            cout << "x的值为" ;
                            cin >> x ;
                            cout << "y的值为" ;
                            cin >> y ;
                            cout << "x+y=" << x+y ; 
                            cout << endl ;
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ;
                        }
                        else
                        {
                            cout << "你已选择普通加法,请输入x,y:" << endl ;
                            int x , y ;
                            cout << "x的值为" ;
                            cin >> x ;
                            cout << "y的值为" ;
                            cin >> y ;
                            cout << "|x+y|=" << abs(x+y) ; 
                            cout << endl ;
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ;
                        }
                    } 
                    if(a=='b')
                    {
                        system("cls"); 
                        cout << "你已选择减法功能,请输入x,y="<< endl ;
                        double x , y ;
                        cout << "x=" ;
                        cin >> x ;
                        cout << "y=" ;
                        cin >> y ;
                        cout << "x+y=" << x+y ;
                        cout << endl ;
                        cout << "请选择继续或退出:" << endl ;
                        cout << "[1]继续" << endl ;
                        cout << "[2]退出" << endl ;
                        cout << "请选择:" ;
                        cin >> w ; 
                    } 
                    if(a=='c')
                    {
                        system("cls"); 
                        cout << "你已选择乘法功能,请输入x,y="<< endl ;
                        double x , y ;
                        cout << "x=" ;
                        cin >> x ;
                        cout << "y=" ;
                        cin >> y ;
                        cout << "x*y=" << x*y ;
                        cout << endl ;
                        cout << "请选择继续或退出:" << endl ;
                        cout << "[1]继续" << endl ;
                        cout << "[2]退出" << endl ;
                        cout << "请选择:" ;
                        cin >> w ;
                    } 
                    if(a=='d')
                    {
                        system("cls"); 
                        cout << "你已选择除法功能,请选择除法类型:"<< endl ;
                        cout << "   [1]整数除法"<< endl ;
                        cout << "   [2]余数除法"<< endl ;
                        cout << "   [3]小数除法"<< endl ;
                        int b ; 
                        cout << "除法类型:" ;
                        cin>>b;
                        if(b==1)
                        {
                            int x , y ;
                            cout << "你已选择整数除法,请输入x,y:" << endl ; 
                            cout << "x=" ;
                            cin>>x;
                            cout << "y=" ;
                            cin>>y;
                            if(y==0)
                            {
                                cout << "Eorro" ;
                                cout << endl ;
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ;
                            }
                            if(y!=0)
                            {
                                cout << "x/y=" << x/y ;
                                cout << endl ;
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ; 
                            }
                        }
                        if(b==2)
                        {
                            int x , y ;
                            cout << "你已选择余数除法,请输入x,y:" << endl ; 
                            cout << "x=" ;
                            cin>>x;
                            cout << "y=" ;
                            cin>>y;
                            if(y==0)
                            {
                                cout << "Eorro" ;
                                cout << endl ;
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ;
                            }
                            if(y!=0)
                            {
                                cout << "x/y=" << x/y << "-------" << x-x/y*y;
                                cout << endl ;
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ; 
                            }
                        }
                        if(b==3)
                        {
                            double x , y ;
                            cout << "你已选择小数除法,请输入x,y:" << endl ; 
                            cout << "x=" ;
                            cin>>x;
                            cout << "y=" ;
                            cin>>y;
                            if(y==0)
                            {
                                cout << "Eorro" ;
                                cout << endl ;
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ;
                            }
                            if(y!=0)
                            {
                                cout << "x/y=" << x/y ;
                                cout << endl ;
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ; 
                            }
                        }
                    } 
                    if(a=='e')
                    {
                        system("cls"); 
                        cout << "你已选择循环功能,请选择循环种类:" << endl ;
                        cout << "    [1] 分行循环 " << endl ;
                        cout << "    [2] 空格循环 " << endl ;
                        int b ;
                        cout << "循环种类为:" ;
                        cin >> b ;
                        if(b==1)
                        {
                            cout << "你已选择分行循环,请选择功能:"<< endl ;
                            cout << "    [1] 字符循环" << endl ;
                            cout << "    [2] 数字循环" << endl ;
                            cout << "循环功能为:" ;
                            int c ;
                            cin >> c ;
                            if(c==1)
                            {
                                cout << "你已选择字符循环,请输入x,y" << endl ;
                                int x ;
                                char y ; 
                                cout << "循环次数x=";
                                cin >> x ;
                                cout << "循环数量y="; 
                                cin >> y ;
                                for( int i ; i < x ; i++ )
                                {
                                    cout << (char)y << endl ;
                                }
                                cout << endl ;
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ;
                            } 
                            if(c==2)
                            {
                                system("cls");
                                cout << "Error                        SYSTEN     <DIR>       WEW               66457 10-01-99" << endl ;
                                cout << "You can't visit              READNE     <DIR>       SAE               77456 10-01-99" << endl ;
                                cout << "You want to fix it           NOPEDA     <DIR>       NJN               44895 10-01-99" << endl ;
                                cout << "But now,A problem has been detected and This procedure has been       84614 10-01-99" << endl ;
                                cout << "Shut down to prevent damage to your procedure.                        15614 10-01-99" << endl ;
                                cout << "If this is the first time you've seen this stop error screen,         45154 10-01-99" << endl ;
                                cout << "restart your computer.                  <DIR>       TXT               26926 10-01-99" << endl ;
                                cout << "If this screen appears again,           <DIR>       BMB               46080 10-01-99" << endl ;
                                cout << "follow these steps:                     <DIR>       EXE               33727 10-01-99" << endl ;
                                cout << "Check to be sure you have adequate disk space.      AVT               39594 10-01-99" << endl;
                                cout << "If a driver is identified in the stop message,      DIR               55974 10-01-99" << endl ;
                                cout << "disable the driver or check with the manufacturer for driver updates. 45612 10-01-99" << endl ;
                                cout << "Try changing video adapterscheck for any DIOS                         88614 10-01-99" << endl ;
                                cout << "Disable BIOS memory options such as caching or shadowing              44614 10-01-99" << endl ;
                                cout << "if you need tu use safe Mode to remove or disable components,         26481 10-01-99" << endl ;
                                cout << "Press F8 to select advanced startup options,                          15415 10-01-99" << endl ;
                                cout << "restart your computer.and then select safe mode                       15453 10-01-99" << endl ;
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ;
                            }
                        }
                        if(b==2)
                        {
                            cout << "你已选择空格循环,请选择功能:"<< endl ;
                            cout << "    [1] 字符循环" << endl ;
                            cout << "    [2] 数字循环" << endl ;
                            cout << "循环功能为:" ;
                            int c ;
                            cin >> c ;
                            if(c==1)
                            {
                                cout << "你已选择字符循环,请输入x,y" << endl ;
                                int x ;
                                char y ; 
                                cout << "循环次数x=";
                                cin >> x ;
                                cout << "循环数量y="; 
                                cin >> y ;
                                for( int i ; i < x ; i++ )
                                {
                                    cout << y << " " ;
                                }
                                cout << endl ;
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ;
                            } 
                            if(c==2)
                            {
                                cout << "你已选择数字循环,请输入x,y" << endl ;
                                int x ;
                                int y ; 
                                cout << "循环次数x=";
                                cin >> x ;
                                cout << "循环数量y="; 
                                cin >> y ;
                                for( int i ; i < x ; i++ )
                                {
                                    cout << y << " " ;
                                }
                                cout << endl ;
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ;
                            }
                        }
                    } 
                    if(a=='f')
                    {
                        system("cls"); 
                        cout << "你已选择保留小数,请输入x,y="<< endl ;
                        cout << "注意事项 :x不能超过[5]" << endl ; 
                        int x ;
                        double y ;
                        cout << "保留位数x=";
                        cin >> x ;
                        cout << "保留前数y=";
                        cin >> y ;
                        if(x==0)
                        {
                            cout << "将" << y << "保留" << x << "位小数,现小数为:";
                            printf("%.0f",y);
                            cout << endl ;
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ;
                        }
                        if(x==1)
                        {
                            cout << "将" << y << "保留" << x << "位小数,现小数为:";
                            printf("%.1f",y);
                            cout << endl ;
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ;
                        }
                        if(x==2)
                        {
                            cout << "将" << y << "保留" << x << "位小数,现小数为:";
                            printf("%.2f",y);
                            cout << endl ;
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ;
                        }
                        if(x==3)
                        {
                            cout << "将" << y << "保留" << x << "位小数,现小数为:";
                            printf("%.3f",y);
                            cout << endl ;
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ;
                        }
                        if(x==4)
                        {
                            cout << "将" << y << "保留" << x << "位小数,现小数为:";
                            printf("%.4f",y);
                            cout << endl ;
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ;
                        }
                        if(x==5)
                        {
                            cout << "将" << y << "保留" << x << "位小数,现小数为:";
                            printf("%.5f",y);
                            cout << endl ;
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ;
                        }
                        if(x>5||x<0)
                        {
                            system("cls");
                            cout << "Error                        SYSTEN     <DIR>       WEW               66457 10-01-99" << endl ;
                            cout << "You can't visit              READNE     <DIR>       SAE               77456 10-01-99" << endl ;
                            cout << "You want to fix it           NOPEDA     <DIR>       NJN               44895 10-01-99" << endl ;
                            cout << "But now,A problem has been detected and This procedure has been       84614 10-01-99" << endl ;
                            cout << "Shut down to prevent damage to your procedure.                        15614 10-01-99" << endl ;
                            cout << "If this is the first time you've seen this stop error screen,         45154 10-01-99" << endl ;                
                            cout << "restart your computer.                  <DIR>       TXT               26926 10-01-99" << endl ;
                            cout << "If this screen appears again,           <DIR>       BMB               46080 10-01-99" << endl ;
                            cout << "follow these steps:                     <DIR>       EXE               33727 10-01-99" << endl ;
                            cout << "Check to be sure you have adequate disk space.      AVT               39594 10-01-99" << endl;
                            cout << "If a driver is identified in the stop message,      DIR               55974 10-01-99" << endl ;
                            cout << "disable the driver or check with the manufacturer for driver updates. 45612 10-01-99" << endl ;
                            cout << "Try changing video adapterscheck for any DIOS                         88614 10-01-99" << endl ;
                            cout << "Disable BIOS memory options such as caching or shadowing              44614 10-01-99" << endl ;
                            cout << "if you need tu use safe Mode to remove or disable components,         26481 10-01-99" << endl ;
                            cout << "Press F8 to select advanced startup options,                          15415 10-01-99" << endl ;
                            cout << "restart your computer.and then select safe mode                       15453 10-01-99" << endl ;
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ;
                            return 0 ;
                        }
                    } 
                    if(a=='g')
                    {
                        system("cls"); 
                        cout << "你已进入几何计算,请选择功能:" << endl ; 
                        cout << "[1]周长计算" << endl ; 
                        cout << "[2]面积计算" << endl ; 
                        cout << "[3]体积计算" << endl ; 
                        int x ;
                        cout << "请选择功能:" ; 
                        cin >> x ;
                        if(x==1)
                        {
                            system("cls"); 
                            cout << "你已进入周长计算,请选择形状:" << endl ; 
                            cout << "[1]矩形计算" << endl ; 
                            cout << "[2]圆形计算" << endl ;
                            int y ;
                            cout << "请选择形状:" ;
                            cin >> y ;
                            if(y==1)
                            {
                                system("cls"); 
                                cout << "请输入长和宽:" << endl ; 
                                double m , n ;
                                cout << "长=" ;
                                cin >> m ;
                                cout << "宽=" ;
                                cin >> n ;
                                cout << "矩形的周长为:" << 2*m+2*n << endl ;
                                cout << "          *************" << endl ; 
                                cout << "          *           *" << endl ; 
                                cout << "          *           *" << endl ; 
                                cout << "          *************" << endl ; 
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ;
                            } 
                            else
                            {
                                system("cls"); 
                                cout << "请输入半径:" << endl ;
                                int m ;
                                cout << "半径r=" ;
                                cin >> m ;
                                cout << "圆的周长为:" << 2 * m * 3.14 << endl ;
                                cout << "                 *******" << endl ; 
                                cout << "              *           *" << endl ; 
                                cout << "             *             *" << endl ; 
                                cout << "             *             *" << endl ; 
                                cout << "             *             *" << endl ;
                                cout << "              *           *" << endl ; 
                                cout << "                 *******" << endl ;  
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ; 
                            } 
                        }
                        if(x==2)
                        {
                            system("cls"); 
                            cout << "你已进入面积计算,请选择形状:" << endl ; 
                            cout << "[1]矩形计算" << endl ; 
                            cout << "[2]圆形计算" << endl ;
                            int y ;
                            cout << "请选择形状:" ;
                            cin >> y ;
                            if(y==1)
                            {
                                system("cls"); 
                                cout << "请输入长和宽:" << endl ; 
                                double m , n ;
                                cout << "长=" ;
                                cin >> m ;
                                cout << "宽=" ;
                                cin >> n ;
                                cout << "矩形的面积为:" << m*n << endl ;
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ;
                            } 
                            else
                            {
                                system("cls"); 
                                cout << "请输入半径:" << endl ;
                                int m ;
                                cout << "半径r=" ;
                                cin >> m ;
                                cout << "圆的面积为:" << m * m * 3.14 << endl ;
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ;
                            } 
                        } 
                        if(x==3)
                        {
                            system("cls"); 
                            cout << "你已进入体积计算,请选择形状:" << endl ; 
                            cout << "[1]矩形计算" << endl ; 
                            cout << "[2]圆形计算" << endl ;
                            int y ;
                            cout << "请选择形状:" ;
                            cin >> y ;
                            if(y==1)
                            {
                                system("cls"); 
                                cout << "请输入长、宽和高:" << endl ; 
                                double m , n , r ; 
                                cout << "长=" ;
                                cin >> m ;
                                cout << "宽=" ;
                                cin >> n ;
                                cout << "高=" ;
                                cin >> r ; 
                                cout << "矩形的体积为:" << m*n*r << endl ;
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ;
                            } 
                            else
                            {
                                system("cls"); 
                                cout << "请输入半径:" << endl ;
                                int m ;
                                cout << "半径r=" ;
                                cin >> m ;
                                cout << "圆的体积为:" << 4/3*3.14*m*m*m << endl ;
                                cout << "请选择继续或退出:" << endl ;
                                cout << "[1]继续" << endl ;
                                cout << "[2]退出" << endl ;
                                cout << "请选择:" ;
                                cin >> w ;
                            } 
                        }
                    } 
                    if(a=='h')
                    {
                        system("cls"); 
                        cout << "你已进入乘方计算,请输入数值:" << endl ;
                        int m , n ;
                        cout << "请输入底数:" ;
                        cin >> m ;
                        cout << "请输入指数:" ;
                        cin >> n ;
                        cout << n << "的" << m << "次方是:" ;
                        long long x = pow(m,n) ;
                        cout << x << endl ;
                        cout << "请选择继续或退出:" << endl ;
                        cout << "[1]继续" << endl ;
                        cout << "[2]退出" << endl ;
                        cout << "请选择:" ;
                        cin >> w ; 
                    }
                    if(a=='i')
                    {
                        system("cls");
                        cout << "你已进入二进制&十进制,请选择类型:" << endl ;
                        cout << "[1]二进制转十进制" << endl ;
                        cout << "[2]十进制转二进制" << endl ;
                        int b ;
                        cout << "计算类型:" << endl;
                        cin >> b ;
                        if(b==1)
                        {
                            cout << "你已选择二进制转十进制功能,请输入二进制:" << endl ;
                            long long z ;
                            cout << "原数为:" ;
                            cin >> z ;
                            int n=0,m=1;
                            while(z){
                                n=n+z%10*m;
                                m=m*2;
                                z/=10;
                            }
                            cout << "原数的十进制为" << n << endl ; 
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ; 
                        }
                        if(b==2)
                        {
                            cout << "你已选择十进制转二进制功能,请输入十进制:" << endl ;
                            long long z ;
                            cout << "原数为:" ;
                            cin >> z ;
                            string ans,b="01";{
                                while(z>0){
                                    ans=b[z%2]+ans;
                                    z/=2; 
                                }
                            }   
                            cout << "原数的十进制为" << ans << endl ;
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ; 
                        }
                    }
                    if(a=='j')
                    {
                        system("cls"); 
                        cout << "你已进入分解质因数功能,请选择:" << endl ;
                        cout << "[1]列举质因数" << endl ;
                        cout << "[2]质因数数量" << endl ; 
                        cout << "[3]最大质因数" << endl ; 
                        cout << "[4]最小质因数" << endl ;
                        int b;
                        cout << "计算功能:" ;
                        cin>>b;
                        if(b==1)
                        {
                            cout << "你已选择列举质因数,请输入num" << endl ;
                            cout << "本系统将会输出num的所有因数." << endl ;
                            long long num ;
                            cout << "num为:" ;
                            cin >> num ;
                            for(int i=2;i<=num/2;i++){
                                if(num%i==0){
                                    int j;
                                    for(j=2;j<=sqrt(i);j++){
                                        if(i%j==0){
                                            cout << "num没有因数" << endl ; 
                                        }
                                    }
                                    if(j>sqrt(i)){
                                        cout << "num除自身外的因数为:" << i << " " ;
                                    }
                                }
                            } 
                            cout << endl ; 
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ;
                        }
                        if(b==2)
                        {
                            cout << "你已选择质因数数量,请输入num" << endl ;
                            cout << "本系统将会输出num的所有因数的数量" << endl ;
                            long long num ;
                            cout << "num为:" ;
                            cin >> num ;
                            int a ;
                            for(int i=2;i<=num/2;i++){
                                if(num%i==0){
                                    int j;
                                    for(j=2;j<=sqrt(i);j++){
                                        if(i%j==0){
                                            cout << "num没有因数" << endl ; 
                                            break;
                                        }
                                    }
                                    if(j>sqrt(i)){
                                        a++;
                                    }
                                }
                            }
                            cout << "num除自身外的因数个数:" << a << endl ;
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ;
                        }
                        if(b==3)
                        {
                            cout << "你已选择最大质因数,请输入num" << endl ;
                            cout << "本系统将会输出num的最大因数" << endl ;
                            long long num ;
                            cout << "num为:" ;
                            cin >> num ;
                            int a ;
                            for(int i=2;i<=num;i++){
                                if(num%i==0){
                                    int j;
                                    for(j=2;j<=sqrt(i);j++){
                                        if(i%j==0){
                                            cout << "num没有因数" << endl ; 
                                            break;
                                        }
                                    }
                                    if(j>sqrt(i)){
                                        a=i;
                                    }
                                }
                            }
                            cout << "num的最大因数为" << a << endl ;
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ;
                        }
                        if(b==4)
                        {
                            cout << "你已选择最小质因数,请输入num" << endl ;
                            cout << "本系统将会输出num的最小因数" << endl ;
                            long long num ;
                            cout << "num为:" ;
                            cin >> num ;
                            int a ;
                            for(int i=2;i<=num;i++){
                                if(num%i==0){
                                    int j;
                                    for(j=2;j<=sqrt(i);j++){
                                        if(i%j==0){
                                            break;
                                        }
                                    }
                                    if(j>sqrt(i)){
                                        a=i;
                                        break;
                                    }
                                }
                            }
                            cout << "num的最小因数为" << a << endl ;
                            cout << "请选择继续或退出:" << endl ;
                            cout << "[1]继续" << endl ;
                            cout << "[2]退出" << endl ;
                            cout << "请选择:" ;
                            cin >> w ;
                        }
                    }
                    if(a=='k')
                    {
                        system("cls"); 
                        cout << "欢迎下次登录 "<< (char)(92) <<" ^-^ / " << endl ;
                        return 0 ;
                    }
                }
            }
            system("cls"); 
            cout << "欢迎下次登录 "<< (char)(92) <<" ^-^ / " << endl ;
        }
        else
        {
            return 0;
            break ;
        }
    }
    return 0;
}

[返回主基地]

[返回基地大厅]