用C语言编写个人理财软件
要求不高,只要收入和支出等简单的编写代码就可以了!
程序代码:
#include <stdio.h> #include <stdlib.h> float sum; void lock() { long int a; printf("请输入密码!\n"); scanf("%d",&a); if(a==123456) {printf("密码输入正确,欢迎进入家庭理财系统!\n\n\n\n\n");} else {printf("密码输入错误!\n");return;} } void calculator() {int ri, repeat; int op1, op2, res; char open; scanf("%d", &repeat); for(ri=1; ri<=repeat; ri++){ scanf("%d", &op1); open= getchar(); res=op1; while(open!='='){ scanf("%d",&op2); if(open=='+') res=res+op2; if(open=='-') res=res-op2; if(open=='*') res=res*op2; if(open=='/') res=res/op2; open=getchar();} printf("%d\n", res); } void inquire about() {printf("当前余额为:%d元:\n",sum);} void ncome(); {float x; printf("请输入进账数额:\n"); scanf("%f",&x); sum=sum+x; printf("按任意键返回......"); getchar(); } void disburse() {float x; printf("请输入支出数额:\n"); scanf("%f",&x); sum=sum-x; printf("按任意键返回......."); getchar(); return; } void account activity() {int x; printf("***********************************\n"); printf("1.支出 2.进账 3.退出\n"); printf("***********************************\n"); scanf("%d",&x); switch(x) {case 1: disburse();break; case 2: ncome();break; case 3: printf("欢迎使用,再见!\n");break;break; case 4: inquire about();break; } } void password() { long int a; printf("请输入密码!\n"); scanf("%d",&a); if(a==123456) {printf("密码输入正确,欢迎进入家庭理财系统!\n\n\n\n\n");} else {printf("密码输入错误!\n");break;} } void main() { password(); int x; printf("\n******************************\n"); printf("\n家庭理财系统1.0 by sunyh1999\n"); printf("\n******************************\n"); printf("请选择管理项目:\n"); printf("1.详细账目输入\n"); printf("2.查询当前余额\n"); printf("3.小工具(计算器)\n"); printf("4.锁定管理系统\n"); printf("5.退出\n"); scanf("%d",&x); switch(x) {case 1: account activity();break; case 2: inquire about break; case 3: calculator();break; case 4: lock();break; case 5: printf ("欢迎再次使用,再见!");break; break; default:printf ("输入错误!");break; break; } }