Advertisement
chhu0830

homework3E1B34.cpp

May 28th, 2015
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.99 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. #include <iostream>
  4. using  std::cin;
  5. using  std::cout;
  6. using  std::endl;
  7. int i,counter=0;
  8. int a=4,b,c,d,e,f,g;
  9. char passwd[6] = "CYWEI",userpw[6];
  10. char ch[6];
  11. char change2[10];
  12.  
  13. struct student
  14.     {
  15.       char name[10];
  16.       char sex[6];
  17.       int age;
  18.       int chinesegrade;
  19.     } ;
  20. struct student s[10];
  21.  
  22. void show_picture(void) {
  23.     cout<<"                      EEEEEEEEEEEEEEEE\n";
  24.     cout<<"                    E                  E\n";
  25.     cout<<"                  E                      E\n";
  26.     cout<<"                E   33333          4   4   E\n";
  27.     cout<<"              E         3          4   4     E\n";
  28.     cout<<"            E           3          4   4       E\n";
  29.     cout<<"          E         33333          444444         E\n";
  30.     cout<<"        E               3              4           E\n";
  31.     cout<<"        E               3              4           E\n";
  32.     cout<<"          E         33333              4         E\n";
  33.     cout<<"            E                                  E\n";
  34.     cout<<"              E            E343434           E\n";
  35.     cout<<"                E                          E\n";
  36.     cout<<"                  E                      E\n";
  37.     cout<<"                    E                  E\n";
  38.     cout<<"                      EEEEEEEEEEEEEEEE\n";
  39.     cout<<"                            111111\n";
  40.     cout<<"                            111111\n";
  41.     cout<<"                         3    11    4\n";
  42.     cout<<"                          3   11   4\n";
  43.     cout<<"                           33311444\n";
  44.     cout<<"                              11\n";
  45.     cout<<"                              11\n";
  46.     cout<<"                              11\n";
  47.     cout<<"                              11\n";
  48.     cout<<"                              11\n";
  49.     cout<<"                             111\n";
  50.     cout<<"                           11   11\n";
  51.     cout<<"                         11       11\n";
  52.     cout<<"\n";
  53.     cout<<"I am  E1B34\n";
  54.     system("PAUSE");
  55. }
  56.  
  57. int main(void) {
  58.     do {
  59.         cout << "±K½X\n";
  60.         cout << "½Ð¿é¤J±K½X:";
  61.         gets(userpw);
  62.         if (strcmp(passwd,userpw) != 0)
  63.         {
  64.             ++counter;
  65.             cout<<"±K½X¿ù½Ð­«¿é¤J";
  66.             if(counter==4)
  67.             {
  68.                 cout<<"±K½X¿ù¤T¦¸°h¥X";
  69.                 system ("PAUSE");
  70.                 system ("CLS");
  71.                 return 0;
  72.             }
  73.         }
  74.     } while(strcmp(passwd,userpw) != 0);
  75.     system("pause");
  76.     system("CLS");
  77.     show_picture();
  78.     while(1) { //°j°é
  79.         cout<<"********************************************************\n";
  80.         cout<<"  a-·s¼W¤@µ§¾Ç¥Í¸ê®Æ                                    \n";
  81.         cout<<"  b-¦C¥X¥Ø«e¨t²Î¤ºªº¸ê®Æ                                \n";
  82.         cout<<"  c-§ä¬Y¤@µ§¾Ç¥Í¸ê®Æ                                    \n";
  83.         cout<<"  d-§R°£¬Y¤@µ§¾Ç¥Í¸ê®Æ                                  \n";
  84.         cout<<"  e-¤@°ê¤å¦¨ÁZ°µ±Æ§Ç                                    \n";
  85.         cout<<"  g-µ²§ôµ{¦¡                                            \n";
  86.         cout<<"********************************************************\n";
  87.         scanf("%c", &i);
  88.         system("cls"); 
  89.         switch(i)
  90.         {  
  91.             case 'a':
  92.                 cout<<"¿é¤J¸ê®Æ";
  93.                 cout<<"©m¦W";
  94.                 cin>>s[a].name;
  95.                 cout<<"©Ê§OBOY / GIRL";
  96.                 cin>>s[a].sex;
  97.                 cout<<"¦~¬ö";
  98.                 cin >> s[a].age;
  99.                 cout<<"°ê¤å¦¨ÁZ";
  100.                 cin >> s[a].chinesegrade;
  101.                 a++;
  102.                 break;
  103.            
  104.            
  105.                
  106.             case 'b':
  107.                 strcpy(s[1].name, "a");
  108.                 strcpy(s[2].name, "b");
  109.                 strcpy(s[3].name, "c");
  110.                 strcpy(s[1].sex, "b");
  111.                 strcpy(s[2].sex, "g");
  112.                 strcpy(s[3].sex, "B");
  113.                 s[1].age = 19;
  114.                 s[2].age = 19;
  115.                 s[3].age = 19;
  116.                 s[1].chinesegrade = 40;
  117.                 s[2].chinesegrade = 70;
  118.                 s[3].chinesegrade = 20;
  119.                 for(b=1;b<a;b++)//¥Î°j°é§â¨t²Î¤º¦³ªº¾Ç¥Í¸ê®Æ¥þ¿é¥X
  120.                  {
  121.                     cout<<"©m¦W"<<s[b].name;
  122.                     cout<<"©Ê§O"<<s[b].sex;
  123.                     cout<<"¦~¬ö"<<s[b].age;
  124.                     cout<<"¦¨ÁZ"<<s[b].chinesegrade;
  125.                  }
  126.  
  127.             system("pause");
  128.             break;
  129.  
  130.  
  131.  
  132.         case 'c':
  133.            
  134.              
  135.             cin>>c;
  136.             cout<<"©m¦W"<<s[c].name;
  137.             cout<<"©Ê§O"<<s[c].sex;
  138.             cout<<"¦~¬ö"<<s[c].age;
  139.             cout<<"¦¨ÁZ"<<s[c].chinesegrade;
  140.            
  141.         system("pause");
  142.         break;
  143.                
  144.                
  145.                
  146.         case 'd':
  147.  
  148.             int h;
  149.             cin>>h;
  150.             strcpy(s[h].name,s[11].name);
  151.             strcpy(s[h].sex,s[11].sex);
  152.             s[h].age=s[11].age;
  153.             s[h].chinesegrade=s[11].chinesegrade;
  154.            
  155.             for(b=1;b<a;b++)
  156.          {
  157.             cout<<"©m¦W"<<s[b].name;
  158.             cout<<"©Ê§O"<<s[b].sex;
  159.             cout<<"¦~¬ö"<<s[b].age;
  160.             cout<<"¦¨ÁZ"<<s[b].chinesegrade;
  161.  
  162.          }
  163.  
  164.         system("pause");
  165.         break;
  166.                    
  167.                    
  168.                    
  169.                        
  170.         case 'e':
  171.         for(e=1;e<a;e++)
  172.             {
  173.             for(f=1;f<e;f++)
  174.             {
  175.             if(s[f].chinesegrade>s[f+1].chinesegrade)
  176.             {
  177.             s[11]=s[f];
  178.             s[f]=s[f+1];
  179.             s[f+1]=s[11];                          
  180.             }
  181.             }
  182.             }
  183.             for(b=1;b<a;b++)
  184.             {
  185.             cout<<"©m¦W:"<<s[b].name<<endl;
  186.             cout<<"©Ê§O:"<<s[b].sex<<endl;
  187.             cout<<"¦~¬ö:"<<s[b].age<<endl;
  188.             cout<<"¦¨ÁZ:"<<s[b].chinesegrade;
  189.             }
  190.  
  191.         system("pause");
  192.         break;
  193.                            
  194.         case 'g'://¿ï³æd
  195.         system("pause");//¼È°±
  196.         return 0;//µ²§ô
  197.         }
  198.     }
  199. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement