commit afc3e63766a59e327100491c59f2ce45a28c82a3 Author: m46231805 <18408000514@stu.hut.edu.cn> Date: Fri Jan 11 17:42:02 2019 +0800 first commit diff --git a/课设.c b/课设.c new file mode 100644 index 0000000..5aa7f21 --- /dev/null +++ b/课设.c @@ -0,0 +1,462 @@ +#include +#include +#include +/* + 1¡¢¹ÜÀíÔ±µÇ¼ + 2¡¢´æÇ® + 3¡¢È¡Ç® + 4¡¢×¢²áÓû§ + 5¡¢Ïú»§ + 6¡¢¹Òʧ + 7¡¢Óû§½¨ÒéÓë»ØÀ¡ + 8¡¢Óû§²éѯ + 9¡¢ËùÓÐÓû§²éѯ + +*/ +struct USER{ + char name[32]; + char name_loss[32]; + char password[32]; + double account_balance; +}user[1000]; + + +void releace_reporting_loss();//½â¹Ò ³ÂСÁú +void keeper_enter(); //¹ÜÀíÔ±Éí·ÝÑéÖ¤ ³ÂСÁú +void withdraw_money(); //È¡Ç® Å·³å +void save_money(); //´æÇ® Å·³å +void user_account(); //Ïú»§ ³ÂСÁú +void user_registration(); //¿ª»§ Å·³å +void reporting_loss(); //¹Òʧ ³ÂСÁú +void user_find(); //Óû§²éѯ Å·³å +void user_total(); //Óû§×ÜÀÀ ³ÂСÁú +void transfer(); //תÕË Å·³å +void exit_(); //Í˳ö Å·³å +void user_feedback(); //Óû§·´À¡ ³ÂСÁú +int user_name_vf(); //Óû§ÃûÑéÖ¤ Å·³å +int user_password_vf(int); //ÃÜÂëÑéÖ¤ Å·³å +int reporting_loss_vf(int); //¹ÒʧÑéÖ¤ ³ÂСÁú + +/* +char user_name[1000][32]; //Óû§Ãû +char user_password[1000][32]; // Óû§ÃÜÂë +char user_name_loss[1000][32];//¹ÒʧÓû§Ãû +double account_balance[1000]; //Óà¶î +*/ +int user_num=0;//Óû§Êý +int user_loss_num=0;//¹ÒʧÓû§Êý +char feedback_a[1000][1000]; +int feedback_num=0; //·´À¡Êý + +int main(int argc, char *argv[]) +{ + keeper_enter(); + int menu=1; //²Ëµ¥Ñ­»·²ÎÊý + while(menu) + { + + printf(" **************************************************************** \n"); + printf(" * *\n"); + printf(" * <1> ¿ª»§ <2> ´æ¿î <3> È¡¿î *\n"); + printf(" * <4> תÕË <5> ²éѯ <6> Ïú»§ *\n"); + printf(" * <7> ¹Òʧ <8> ½â¹Ò <0> Í˳ö *\n"); + printf(" * <9> ²éѯËùÓÐÓû§ÐÅÏ¢ <10> Óû§·´À¡ *\n"); + printf(" * *\n"); + printf(" **************************************************************** \n"); + printf("ÇëÑ¡Ôñ²Ù×÷Ñ¡Ï"); + while(1) + { + + scanf("%d",&menu); + if(menu<0||menu>10) + { + printf("ÇëÊäÈëÕýÈ·Ñ¡Ï"); + continue; + } + break; + } + switch(menu) + { + case 1: //¿ª»§ + user_registration(); + break; + case 2: //´æ¿î + save_money(); + break; + case 3: //È¡¿î + withdraw_money(); + break; + case 4: //תÕË + transfer(); + break; + case 5: //²éѯ + user_find(); + break; + case 6: //Ïú»§ + user_account(); + break; + case 7: //¹Òʧ + reporting_loss(); + break; + case 8: //½â¹Ò + releace_reporting_loss(); + break; + case 9: //²éѯËùÓÐÓû§ÐÅÏ¢ + user_total(); + break; + case 10: //·´À¡ + user_feedback(); + break; + } + } + return 0; +} +void keeper_enter() //¹ÜÀíÔ±Éí·ÝÑéÖ¤ +{ + int keeper_enter_pm=1; //µÇ¼ѭ»·²ÎÊý + char name1[10]; + char password1[20]; + printf("**************»¶Ó­½øÈëÒøÐйÜÀíϵͳ£¡£¡£¡**************\n"); + while(keeper_enter_pm) + { + if(keeper_enter_pm==1) + printf(" ********ÇëÏȽøÐйÜÀíÔ±ÑéÖ¤******** \n"); + else + printf("¸Ã¹ÜÀíÔ±²»´æÔÚ»òÕßÃÜÂë´íÎó£¬ÇëÔÙ´ÎÑéÖ¤\n"); + printf("*ÇëÊäÈë¹ÜÀíÔ±Óû§Ãû£º"); + scanf("%s",name1); + printf("*ÇëÊäÈëÃÜÂ룺") ; + scanf("%s",password1); + if(strcmp(name1,"1805")==0&&strcmp(password1,"1805")==0) + break; + keeper_enter_pm=2; + } +} +void user_account() //Ïú»§ +{ + + int i,n,m; + i=user_name_vf(); + m=reporting_loss_vf(i); + if(m==1) + m=user_password_vf(i); + while(m==1) + { + printf("ÇëÔÙ´ÎÈ·ÈÏÊÇ·ñÏú»§£¡\n"); + printf("(1)È·¶¨ £¨2£©·µ»Ø"); + printf("ÇëÊäÈëÑ¡Ï"); + scanf("%d",&n); + if(n==2) + break; + if(n==1) + { + for(;iuser[i].account_balance) + { + printf("ÄãµÄÓà¶î²»×ãÒÔÖ§³Ö´Ë´ÎÈ¡¿î£¡\nÇëÖØÐÂÊäÈëÈ¡¿î½ð¶î£º\n"); + }else{ + user[i].account_balance=user[i].account_balance-money; + printf("´Ë´ÎÈ¡¿î³É¹¦£¡\nµ±Ç°Óà¶îΪ£º%.2 lf\n",user[i].account_balance); + } + } +} + + +void user_feedback() //Óû§·´À¡ +{ + int menu1,e; + printf("²Ëµ¥£º\n"); + printf("<1>·´À¡ <2>²éѯ·´À¡\n"); + printf("ÇëÑ¡ÔñÖ¸Á"); + scanf("%d",&menu1); + if(menu1==1) + { + printf("ÇëдÏÂÄú±¦¹óµÄÒâ¼û£º\n"); + scanf("%s",feedback_a[feedback_num]); + feedback_num++; + } + if(menu1==2) + { + for(e=0;e