zoukankan      html  css  js  c++  java
  • C++ 程序设计作业 航空票务管理系统

    仅要求图形界面和范围判断





    #include <iostream>
    #include <cstring>
    #include <cstdio>
    using namespace std;
    string pass_word;
    string real_pass_word = "888888";
    void put_user() //输出客户界面 
    {
    	cout<<endl<<"客户能查看和查询航空信息:"<<endl<<endl;
    	cout<<"请输入航班编号:"<<endl;
    	cout<<"      1.订购机票"<<endl;
    	cout<<"      2.反退机票"<<endl;
    	cout<<"      3.查看航班信息"<<endl;
    	cout<<"      4.查询航班信息"<<endl;
    	cout<<"      0.返回主界面"<<endl;
    	int select_mode = 0;
    	cin>>select_mode;
    	if(select_mode == 0)
    	{
    		cout<<endl<<"已退出系统"<<endl<<endl;;
    			return ;
    	}
    }
    
    
    void put_admin() //输出管理员界面 
    {
    	char pass_word[6];
    	cout<<"请输入管理员密码:"<<endl;
    	int flag = 3;
    	while(flag)
    	{
    		cin>>pass_word;
    		int i;
    		for(i = 0; i < real_pass_word.length() ; i++)
    		{
    			if(pass_word[i] != real_pass_word[i])  //密码判断;
    				break; 
    		}
    		if(i == real_pass_word.length()) //若密码正确则输出操作界面 
    		{
    			cout<<endl<<"欢迎进入管理界面"<<endl;
    			cout<<"输入航班信息"<<endl;
    			cout<<"      1. 订购机票"<<endl;
    			cout<<"      2. 反退机票"<<endl;
    			cout<<"      3. 查看航班信息"<<endl;
    			cout<<"      4. 查询航班信息"<<endl;
    			cout<<"      5. 修改航班信息"<<endl;
    			cout<<"      0. 返回主界面"<<endl;
    			cout<<"请输入编号 0- 5:"<<endl;
    			int select_mode = 0;
    			bool into = false; //判断范围 
    			while( !into ) //循环输入操作项直到项合法 
    			{
    				cin>>select_mode;
    				if(select_mode < 0 || select_mode > 5)
    				{
    					cout<<endl<<"输入错误,请重新输入"<<endl;
    					cout<<"请输入编号 0- 5:"<<endl;
    				}
    				else
    				{
    					into = true;
    				}
    			}
    			if(select_mode == 0)
    			{
    				cout<<endl<<"已退出系统"<<endl<<endl;;
    				return ;
    			}	//此处可通过选择分支结构扩展其他编号操作 
    		}
    		else
    		{
    			cout<<endl<<"管理密码错误!请重新输入"<<endl;
    			if(flag > 0)
    				cout<<"剩余错误次数:"<<flag--<<endl<<endl;
    			else
    			{
    				cout<<"请重新进入系统"<<endl<<endl;
    			}
    		}
    	}
    	return ;
    }
    int put_welcome(int time) //输出欢迎界面 
    {
    	int mode;
    	if(time == 0) // 仅首次输出欢迎表 以后只输出操作提示 效率高 
    	{
    		cout<<"	#-----------------------------#"<<endl;
    		cout<<"	+                             +"<<endl;
    		cout<<"	+                             +"<<endl;
    		cout<<"	+       欢迎进入票务系统      +"<<endl;
    		cout<<"	+           BY 张峻溥         +"<<endl;
    		cout<<"	+                             +"<<endl;
    		cout<<"	#-----------------------------#"<<endl;
    		cout<<endl<<endl<<endl;
    	}
    
    	cout<<"管理员进入请按1, 客户用户进入请按2, 结束请按0:"<<endl;
    
    	cin>>mode;
    
    	if(mode == 1)
    		put_admin();
    	else if(mode == 2)
    		put_user();
    
    	else if(mode == 0)
    		return -1;
    }
    int main()
    {
    	int time = 0;
    	while( true )
    	{
    		int i = put_welcome(time);
    		if(i == -1)
    			break;
    		time ++;
    	}
    	return 0;
    }

  • 相关阅读:
    第二面某知科技的
    面试的提问和大致经过
    抓取菜鸟教程中python内置函数的关键字和链接
    记录下之前写的udp,tcp。很浅显
    python连接mongodb数据库操作
    生成随机字母或数字
    python连接mysql基本操作
    post登录请求
    文件的读写
    request,正则爬虫
  • 原文地址:https://www.cnblogs.com/zeolim/p/12270632.html
Copyright © 2011-2022 走看看