zoukankan      html  css  js  c++  java
  • 古董代码

    这是我从一堆垃圾里掏出来的自己过去写的代码,没有注释,看看大家能不能猜出来它是干什么的(注意:该程序可能有些小儿科!),另外,这个程序还没有最后写完。
     1 #include <iostream>
     2 using namespace std;
     3 
     4 int menu();
     5 void DoTaskOne();
     6 void DoTaskMany(int);
     7 
     8 int main()
     9 {
    10     bool exit = false;
    11     for(;;)
    12     {
    13         int choice = menu();
    14         switch(choice)
    15         {
    16             case (1):
    17             DoTaskOne();
    18             break;
    19             case (2):
    20             DoTaskMany(2);
    21             break;
    22             case(3):
    23             DoTaskMany(3);
    24             break;
    25             case(4):
    26             DoTaskMany(4);
    27             break;
    28             case (5):
    29             exit = true;
    30             break;
    31             default:
    32             cout << "Please select again!"<<endl;
    33             break;
    34         }
    35         if (exit == true)
    36            break;
    37     }
    38     return 0;
    39 }
    40 int menu()
    41 {
    42     int choice;
    43     
    44     cout << "**** Menu ****"<<endl<<endl;
    45     cout << "(1)Choice one."<<endl;
    46     cout<< "(2)Choice two."<<endl;
    47     cout << "(3)Choice three."<<endl;
    48     cout << "(4)Redisplay menu."<<endl;
    49     cout << "(5) Exit."<<endl<<endl;
    50     cout << "";
    51     cin >> choice;
    52     return choice;
    53 }
    54 void DoTaskOne()
    55 {
    56     cout << "1234567"<<endl;
    57 }
    58 void DoTaskMany(int witch)
    59 {
    60     if (witch == 2)
    61        cout << "45678"<<endl;
    62     if (witch == 3)
    63        cout << "788901"<<endl;
    64     else
    65        cout << "Task Three!"<<endl;
    66 }


  • 相关阅读:
    Cheatsheet: 2013 12.01 ~ 12.16
    Cheatsheet: 2013 11.12 ~ 11.30
    Cheatsheet: 2013 11.01 ~ 11.11
    Cheatsheet: 2013 10.24 ~ 10.31
    Cheatsheet: 2013 10.09 ~ 10.23
    Cheatsheet: 2013 10.01 ~ 10.08
    Cheatsheet: 2013 09.22 ~ 09.30
    Cheatsheet: 2013 09.10 ~ 09.21
    Cheatsheet: 2013 09.01 ~ 09.09
    Cheatsheet: 2013 08.20 ~ 08.31
  • 原文地址:https://www.cnblogs.com/empty/p/1242001.html
Copyright © 2011-2022 走看看