当前位置: 首页>>代码示例>>C++>>正文


C++ Create::process_type方法代码示例

本文整理汇总了C++中Create::process_type方法的典型用法代码示例。如果您正苦于以下问题:C++ Create::process_type方法的具体用法?C++ Create::process_type怎么用?C++ Create::process_type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Create的用法示例。


在下文中一共展示了Create::process_type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char** argv)
{
    string input;
    CurrentUserAccounts current_accounts;
    AvailableTickets available_tickets;
    DailyTransaction daily_transactions;
    User current_user;

    /* Verify the correct number of arguments provided */
    if (argc < 4)
    {
        cerr << "Usage:   ./FrontEnd [current user accounts file] [available tickets file] "
             << "[daily transaction file]" << endl
             << "Example: ./FrontEnd user_accounts avail_tickets daily_transaction" << endl;

        return EXIT_FAILURE;
    }

    /* Start the front end, read the input files and parse the contents */
    try
    {
        cout << "Welcome." << endl;

        /* Parse the current user accounts file */
        current_accounts = CurrentUserAccounts(argv[1]);
        cout << "Current user accounts file read successfully." << endl;

        /* Parse the available tickets file */
        available_tickets = AvailableTickets(argv[2]);
        cout << "Available tickets file read successfully." << endl;

        /* Set the filename for the daily transaction file */
        daily_transactions = DailyTransaction(argv[3]);
    }
    catch (Exception& e)
    {
        cerr << e.mesg() << endl;
        return EXIT_FAILURE;
    }


    cout << "> ";
    while(getline(cin, input))
    {
        cout << endl;

        try
        {
            switch(map_code[input])
            {
              case _login:
              {
                  Login login = Login(current_user);

                  cout << "Enter username: ";
                  get_input(cin, input), cout << endl;

                  /* Attempt to login with username provided */
                  current_user = login.process_username(input, current_accounts);
                  current_user.login();
                  cout << "Username accepted." << endl;
                  break;
              }
              case _logout:
              {
                  Logout logout = Logout(current_user);
                  current_user.logout();
                  current_user.reset_sell_status();

                  cout << "Logout complete." << endl;

                  /* Write all session transactions to daily transaction file */
                  daily_transactions.save((Transaction) logout);
                  daily_transactions.write();
                  break;
              }
              case _create:
              {
                  Create create = Create(current_user);

                  /* Process the username */
                  cout << "Enter the username to create: ";
                  get_input(cin, input), cout << endl;
                  create.process_username(input, current_accounts);

                  /* Process the user type, save transaction if successful */
                  cout << "Enter the user type: ";
                  get_input(cin, input), cout << endl;
                  create.process_type(input);

                  daily_transactions.save((Transaction) create);
                  cout << "User created successfully." << endl;
                  break;
              }
              case _delete:
              {
                  Delete __delete = Delete(current_user);

                  /* Process the username, save transaction if successful */
                  cout << "Enter the username to delete: ";
//.........这里部分代码省略.........
开发者ID:gnu-user,项目名称:qa-project,代码行数:101,代码来源:FrontEnd.cpp


注:本文中的Create::process_type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。