个人作业三-ATM管理系统
main函数
ifndef MAIN_H
define MAIN_H
include "stdio.h"
include "math.h"
int check_balance(int);
int drewmoney(int);
int reset_password(int);
void take_card();
int save_money(int );
#endif
#include "main.h"
int main()
{
int account_temp,password_temp,slect_temp;
int account = 123456;//账户
int password = 123456;//密码
int balance = 1000;//余额
printf("welcome to use the ATM !\n\n");
while(1)
{
printf("please input your account number :");
scanf("%d",&account_temp);
printf("please input your password :");
scanf("%d",&password_temp);
if (account_temp==account&&password_temp==password)
{
printf("your account balance is : %d\n\n",balance);
break;
}
else
{
printf("account or password error!!\n");
continue;
}
}
do
{
printf("**************\n");
printf("1.check the balance.\n");
printf("2.withdrew money.\n");
printf("3.reset password.\n");
printf("4.take card.\n");
printf("5.save money.\n");
printf("**************\n");
printf("\n\t\t please Select the project you want to serve:\n");
scanf("%d",&slect_temp);
switch(slect_temp)
{
case 1:
check_balance(balance);
break;
case 2:
balance = drewmoney(balance);
break;
case 3:
password = reset_password(password);
break;
case 4:
take_card();
break;
case 5:
balance = save_money(balance);
break;
}
}while(slect_temp!=4);
return 0;
}
查询余额
include"main.h"
//查询账户余额
int check_balance(int balance)
{
int b;
b = balance;
printf("your account balance is :%d $\n\n",b);
}
取款
//取钱,输入要取金额,金额不足,更新余额。
int drewmoney(int balance)
{
int drew_account,deviation;
printf("please input the account you want to drew :");
scanf("%d",&drew_account);
deviation = balance - drew_account;
if(deviation < 0)
printf("your account balance is not enough!\n");
else printf("please keep your cash: %d $\n",drew_account);
return deviation; //返回余额
}
存款
//存钱,返回新的余额
int save_money(int balance)
{
int save_account;
printf("please input the save account:\n");
scanf("%d",&save_account);
if(save_account<0)
printf("sorry,no negative account!!\n");
else
printf("you have saved money %d $\n",save_account);
return balance+save_account;
}
**运行结果 **

| 任务内容 | 计划完成需要的时间(min) | 实际完成需要的时间(min) |
|---|---|---|
| 计划 | 15 | 10 |
| 估计这个任务需要多少时间,并规划大致工作步骤 | 20 | 15 |
| 开发 | 300 | 350 |
| 需求分析(包括学习新技术) | 40 | 50 |
| 生成设计文档 | 5 | 5 |
| 设计复审 | 5 | 5 |
| 代码规范 | 10 | 20 |
| 具体设计 | 10 | 15 |
| 具体编码 | 50 | 45 |
| 代码复审 | 5 | 5 |
| 测试(自我测试,修改代码,提交修改) | 5 | 5 |
| 报告 | 5 | 5 |
| 测试报告 | 5 | 5 |
| 计算工作量 | 10 | 10 |
| 事后总结,并提出过程改进计划 | 5 | 3 |
浙公网安备 33010602011771号