为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

公交一卡通

2017-08-31 5页 doc 18KB 14阅读

用户头像

is_321635

暂无简介

举报
公交一卡通公交一卡通 #include #include #include void stop(void) { system("pause"); } int main() { int stops=0,money=0,symbol=0,ticket=0; //先定义变量 char chose,choose; system("cls"); printf("\n\t\t||------------------------------||"); printf("\n\t\t||------------------...
公交一卡通
公交一卡通 #include #include #include void stop(void) { system("pause"); } int main() { int stops=0,money=0,symbol=0,ticket=0; //先定义变量 char chose,choose; system("cls"); printf("\n\t\t||------------------------------||"); printf("\n\t\t||------------------------------||"); //第一界面 printf("\n\t\t||-------------Welcome----------||"); printf("\n\t\t||----------use bus traffic-----||"); printf("\n\t\t||--------------card------------||"); printf("\n\t\t||------------------------------||"); printf("\n\t\t||------------------------------||"); printf("\n\n\n\n"); ///查找一下怎么清屏再写 Sleep(4000); system("cls"); printf("\n\t\t||------------------------------||"); printf("\n\t\t||------------------------------||"); printf("\n\t\t| 1.Add new card |"); printf("\n\t\t| 2.Logout card |"); printf("\n\t\t| 3.Modify card |"); //第二界面 printf("\n\t\t| 4.Read card |"); printf("\n\t\t| 5.Save money |"); printf("\n\t\t| 6.Stat.max money |"); printf("\n\t\t| 7.Display |"); printf("\n\t\t| 8.Delete |"); printf("\n\t\t| 0.Exit |"); printf("\n\t\t||------------------------------||"); printf("\n\t\t||------------------------------||"); printf("\n\n\n"); printf("please give your changes:"); scanf("%c",chose); //chose 是自定义的 scanf 函数获取输入字符 !!!注意是字符 型不是数字 switch(chose) { case '1':printf("\n\t\t Your chose is 1");break; case '2':printf("\n\t\t Your chose is 2");break; case '3':printf("\n\t\t Your chose is 3");break; case '4':printf("\n\t\t Your chose is 4");break; ///输入界面 printf("\n\t\t please input your stops");break; scanf ("%c\n",&stops); if (stops<1||stops>30) { printf("\n\t\t input error please try again"); getch(); //重新回到上一界面 } if (symbol==0) { if(stops<=10) { ticket=1; symbol=1; } else if (stops<=15) { //symbol 起 防止非法字符的措施 ticket=2; symbol=1; } //判断 else if (stops<=20) { ticket=2; symbol=1; } else if (stops<=25) { ticket=3; symbol=1; } else if(stops<=30) { ticket=4; symbol=1; } printf("\n\t\t your ticket is %d.",ticket);break; } case '5' :printf("\n\t\t save money"); //case 5 的反复进行 scanf("\n\t\t How much your save:%d",&money); //getch(); if (money<=0) { do { printf("\n\t\t your message is wrong,please input again"); getch(); } while(money<=0);break; } case '6':printf ("\n\t\t Your chose is 6");break; case '7':printf ("\n\t\t Your chose is 7");break; case '8':printf ("\n\t\t Your chose is 8");break; case '0':printf ("\n\t\t Are you sure exit:(y/n)"); scanf("\n\t\t %c",&choose); do { printf("\n\t\t not normal char"); getch(); } while(choose!='Y'&&choose!='y'&&choose!='n'&&choose!='N'); if (choose=='y'||choose=='Y') exit(0); break; default:printf("\n\t\t system is worry.");break; gerch(); } stop(); return(0); }
/
本文档为【公交一卡通】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索