⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 个人财政支出管理.cpp

📁 本程序是对个人财政支出状况的管理
💻 CPP
字号:
#include <iostream.h>
#include <fstream.h>
#include <conio.h>
#include <iomanip.h>

void Deposit();
void Withdraw();
void ViewTotal();
void SetGoal();                
void depositDisplay();
void mainDisplay();
void withdrawDisplay();
void setgoalDisplay();
void viewtotalDisplay();

int main(){
    char select;
        mainDisplay();
        cout<<"\n\n\t<1>  库存"<<endl;
        cout<<"\n\t<2>  支出"<<endl;
        cout<<"\n\t<3>  全部显示"<<endl;
        cout<<"\n\t<4>  既定目标"<<endl;
        cout<<"\n\t<0>  退出"<<endl;
        cout<<"\n\n\t输入选择: ";
        cin>>select;
        if(select == '1'){Deposit();}else{
        if(select == '2'){Withdraw();}else{
        if(select == '3'){ViewTotal();}else{
        if(select == '4'){SetGoal();}else{
        if(select == '0')
		{
			goto mm1;
		}
		else{
        main();
		}
		}}}}
mm1:        return 0;
}

void Deposit(){
        double dAmt = 0;
        char ans;
        double num = 0;
        ifstream get("Deposit.txt");
        get>>num;
        get.close();
        depositDisplay();
        cout<<"\n\n\t输入库存: $";
        cin>>dAmt;
        if(dAmt <= 0){
        cout<<"\n\n\n\n\n"<<endl;
        cprintf("           不可能的数..");
        getch();
        main();
        }else{
        cout<<"\n\n\t输入 <"<<dAmt<<">."<<endl;
        cout<<"\n\t是否继续 <y/n>: ";
        cin>>ans;

        if(ans == 'y' ||ans ==  'Y'){
        dAmt = dAmt + num;
        ofstream save("Deposit.txt");
        save<<dAmt<<endl;
        save.close();
        cout<<"\n\n\n\n\n"<<endl;
        cprintf("             以经成功...\n");
        getch();
        main();
        }else{
        main();
        }
        main();
        }

}

void Withdraw(){
        double wAmt = 0;
        char ans;
        double num = 0;

        ifstream get("Withdraw.txt");
        get>>num;
        get.close();
        withdrawDisplay();
        cout<<"\n\n\t输入支出数额: $";
        cin>>wAmt;
        if(wAmt <= 0){
        cout<<"\n\n\n\n\n"<<endl;
        cprintf("           不可能的数..");
        getch();
        main();
        }else{
        cout<<"\n\n\t输入<"<<wAmt<<">."<<endl;
        cout<<"\n\t是否继续 <y/n>: ";
        cin>>ans;

        if(ans == 'y' || ans == 'Y'){
        wAmt = wAmt + num;
        ofstream save("Withdraw.txt");
        save<<wAmt<<endl;
        save.close();
        cout<<"\n\n\n\n\n"<<endl;
        cprintf("             以经成功...\n");
        getch();
        main();
        }else{
        main();
        }
        main();
        }
}

void SetGoal(){
        double setAmt = 0;
        setgoalDisplay();
        cout<<"\n\n\t建立目标: ";
        cin>>setAmt;
        ofstream set("Goal.txt");
        set<<setAmt<<endl;
        set.close();
        cout<<"\n\n\n\n\n"<<endl;
        cprintf("             目标已建立...\n");
        getch();
        main();
}

void ViewTotal(){
        double dAmt = 0;
        double wAmt = 0;
        double gAmt = 0;
        double balance = 0;
        double newbalance = 0;
        ifstream getDeposit("Deposit.txt");
        getDeposit>>dAmt;
        getDeposit.close();
        ifstream getWithdraw("Withdraw.txt");
        getWithdraw>>wAmt;
        getWithdraw.close();
        ifstream getGoal("Goal.txt");
        getGoal>>gAmt;
        getGoal.close();
        balance = dAmt - wAmt;
        viewtotalDisplay();
        cout<<"\n\n"<<endl;
        cprintf("                          总数");
        cout<<""<<endl;
        cprintf("                          =============");
        cout<<"\n\n"<<endl;
        cprintf("         库存                    支出                 存余 ");
        cout<<"\n"<<endl;
        cout<<setw(15)<<dAmt<<setw(25)<<wAmt<<setw(20)<<balance<<endl;;
        newbalance = gAmt - balance;
        cout<<"\n\n\n"<<endl;
        cprintf("                          总目标");
        cout<<""<<endl;
        cprintf("                          =============");
        cout<<"\n\n"<<endl;
        cprintf("         既定目标                存余                  欠款 ");
        cout<<"\n"<<endl;
        cout<<setw(15)<<gAmt<<setw(25)<<balance<<setw(23)<<newbalance<<endl;
		cout<<'\n\n\n\n';
        getch();
        main();
}

void depositDisplay(){

     cprintf("库存  ");
}

void mainDisplay(){

     cprintf("财政管理   ");
}

void withdrawDisplay(){

     cprintf("支出  ");
}


void setgoalDisplay(){

     cprintf("制定目标 ");
}


void viewtotalDisplay()
{

     cprintf("全部显示 ");
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -