matthileo

Untitled

Aug 17th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 8.22 KB | None | 0 0
  1. //Matthew K
  2. //Windows Controls
  3. //Final Project
  4.  
  5. #include <iostream.h>
  6. #include "katzenm.h"
  7. //katzenm.h is the same as utility.h but with my ColorChange function.
  8. //Random.h and String.h included in katzenm.h.
  9.  
  10. //*******************************************************************************************************************
  11.  
  12. int main()
  13. {
  14.     system("Title Matthew's Crazy Windows Commands Program");
  15.     int Num, RussianNum,Xnum=0,stime,rtime;
  16.     randomize();
  17.     String color, AbortPW="mirror",PWEntered;
  18.     while (Num!=11)
  19.     {
  20.         system("cls");
  21.         cout<<" 0:  Russian Roulette"<<endl;//Play at your own risk.
  22.         cout<<" 1:  Command Prompt"<<endl;
  23.         cout<<" 2:  Control Pannel"<<endl;
  24.         cout<<" 3:  Notepad"<<endl;
  25.         cout<<" 4:  Change Color"<<endl;
  26.         cout<<" 5:  View Time"<<endl;
  27.         cout<<" 6:  Change Time"<<endl;
  28.         cout<<" 7:  Shutdown"<<endl;
  29.         cout<<" 8:  Logoff"<<endl;
  30.         cout<<" 9:  Restart"<<endl;
  31.         cout<<"10:  Abort"<<endl;
  32.         cout<<"11:  End Program"<<endl;
  33.         cout<<"Enter Your Choice: ";
  34.         cin>>Num;
  35.         cout<<endl;
  36.         switch(Num)
  37.         {
  38.             case 0:
  39.                 cout<<"You had to hit 0."<<endl<<"Now you will pay the price."<<endl;
  40.                 RussianNum=random(6);
  41.                 if (RussianNum==0)
  42.                 {
  43.                     system("shutdown -s");
  44.                     cout<<endl<<"Bye-Bye"<<endl;
  45.                     Pause();
  46.                 }
  47.                 else if (RussianNum==1)
  48.                 {
  49.                     system("shutdown -r");
  50.                     cout<<endl<<"Fatal Error: Your computer is melting."<<endl;
  51.                     Pause();   
  52.                 }
  53.                 else if (RussianNum==2)
  54.                 {
  55.                     system("shutdown -l");
  56.                     cout<<endl<<"You are being log-ed off!?!?!??!?!"<<endl;
  57.                     Pause();
  58.                 }
  59.                 else if (RussianNum==3)
  60.                 {
  61.                
  62.                     for (int i=1;i<=100;i++)
  63.                     {
  64.                         cout<<endl<<"Arn't Colors Fun!!!!!!!"<<endl;
  65.                         //ColorChange is in katzenm.h but i still wrote it.
  66.                         ColorChange("27");
  67.                         ColorChange("F4");
  68.                         ColorChange("6B");
  69.                         ColorChange("A2");
  70.                         ColorChange("95");
  71.                         ColorChange("64");
  72.                         ColorChange("12");
  73.                         ColorChange("98");
  74.                         ColorChange("56");
  75.                         ColorChange("94");
  76.                         ColorChange("FB");
  77.                         ColorChange("C2");
  78.                         ColorChange("0F");
  79.                         ColorChange("F0");
  80.                         ColorChange("FA");
  81.                         ColorChange("72");
  82.                         ColorChange("4F");
  83.                         ColorChange("B6");
  84.                         ColorChange("2A");
  85.                         ColorChange("59");
  86.                         ColorChange("34");
  87.                         ColorChange("64");
  88.                         ColorChange("12");
  89.                         ColorChange("98");
  90.                         ColorChange("56");
  91.                         ColorChange("94");
  92.                         ColorChange("FB");
  93.                         ColorChange("C2");
  94.                         ColorChange("0F");
  95.                         ColorChange("F0");
  96.                         ColorChange("A5");
  97.                         ColorChange("2E");
  98.                         ColorChange("2A");
  99.                         ColorChange("B4");
  100.                         ColorChange("6C");
  101.                         ColorChange("D2");
  102.                         ColorChange("9E");
  103.                         ColorChange("FA");
  104.                         ColorChange("32");
  105.                         ColorChange("4A");
  106.                         ColorChange("AF");
  107.                         ColorChange("EC");
  108.                         ColorChange("90");
  109.                         ColorChange("09");
  110.                         ColorChange("64");
  111.                         ColorChange("12");
  112.                         ColorChange("98");
  113.                         ColorChange("56");
  114.                         ColorChange("94");
  115.                         ColorChange("FB");
  116.                         ColorChange("C2");
  117.                         ColorChange("0F");
  118.                         ColorChange("F0");
  119.                         ColorChange("01");
  120.                         ColorChange("02");
  121.                         ColorChange("25");
  122.                         ColorChange("67");
  123.                         ColorChange("94");
  124.                         ColorChange("12");
  125.                         ColorChange("AF");
  126.                         ColorChange("FA");
  127.                         ColorChange("AF");
  128.                         ColorChange("FA");
  129.                         ColorChange("A2");
  130.                     }
  131.                 }
  132.                 else if (RussianNum==4)
  133.                 {
  134.                     system("shutdown -s -t 86400");
  135.                     cout<<endl<<"The suspense is killing you."<<endl;
  136.                     Pause();
  137.                 }
  138.                 else
  139.                 {
  140.                     cout<<endl<<"You win, this time!!!"<<endl;
  141.                     Pause();
  142.                 }
  143.         }
  144.         if (Num==0)
  145.         {
  146.         }
  147.         else if (Num==1)
  148.         {
  149.             cout<<endl<<"Type 'exit' to return to program."<<endl<<"Type 'help' for a list of commands."<<endl;
  150.             Pause();
  151.             cout<<endl;
  152.             system("command");
  153.         }
  154.         else if (Num==2)
  155.             system("control");
  156.         else if (Num==3)
  157.             system("notepad");
  158.         else if (Num==4)
  159.         {
  160.             cout<<endl;
  161.             cout<<"0: Black"<<endl;
  162.             cout<<"1: Blue"<<endl;
  163.             cout<<"2: Green"<<endl;
  164.             cout<<"3: Aqua"<<endl;
  165.             cout<<"4: Red"<<endl;
  166.             cout<<"5: Purple"<<endl;
  167.             cout<<"6: Yellow"<<endl;
  168.             cout<<"7: White"<<endl;
  169.             cout<<"8: Gray"<<endl;
  170.             cout<<"9: Light Blue"<<endl;
  171.             cout<<"A: Light Green"<<endl;
  172.             cout<<"B: Light Aqua"<<endl;
  173.             cout<<"C: Light Red"<<endl;
  174.             cout<<"D: Light Purple"<<endl;
  175.             cout<<"E: Light Yellow"<<endl;
  176.             cout<<"F: Bright White"<<endl;
  177.             cout<<"Enter your color in the [Backcolor][Text Color] format."<<endl;
  178.             cout<<"Enter Your Color: ";
  179.             cin>>color;
  180.             ColorChange(color);
  181.         }
  182.         else if (Num==5)
  183.         {
  184.             system("time/t");
  185.             Pause();
  186.             cout<<endl;
  187.         }
  188.         else if (Num==6)
  189.         {
  190.             system("time");
  191.             cout<<endl;
  192.         }
  193.         else if (Num==7)
  194.         {
  195.             while (true)
  196.             {
  197.                 system("cls");
  198.                 cout<<"Select Shutdown Delay:"<<endl;
  199.                 cout<<"\t0:  Cancel"<<endl;
  200.                 cout<<"\t1:  No Delay"<<endl;
  201.                 cout<<"\t2:  5 Second Delay"<<endl;
  202.                 cout<<"\t3:  30 Second Delay"<<endl;
  203.                 cout<<"\t4:  1 Minute Delay"<<endl;
  204.                 cout<<"\t5:  5 Minute Delay"<<endl;
  205.                 cout<<"\t6:  30 Minute Delay"<<endl;
  206.                 cout<<"\t7:  1 Hour Delay"<<endl;
  207.                 cout<<"\t8:  1 Day Delay"<<endl;
  208.                 cout<<"Enter Your Choice: ";
  209.                 cin>>stime;
  210.                 if (stime==1)
  211.                     system("shutdown -s -t 0");
  212.                 else if (stime==2)
  213.                     system("shutdown -s -t 5");
  214.                 else if (stime==3)
  215.                     system("shutdown -s -t 30");
  216.                 else if (stime==4)
  217.                     system("shutdown -s -t 60");
  218.                 else if (stime==5)
  219.                     system("shutdown -s -t 300");
  220.                 else if (stime==6)
  221.                     system("shutdown -s -t 1800");
  222.                 else if (stime==7)
  223.                     system("shutdown -s -t 3600");
  224.                 else if (stime==8)
  225.                     system("shutdown -s -t 86400");
  226.                 else if (stime==0)
  227.                 {
  228.                     Pause();
  229.                     break;
  230.                 }
  231.                 else
  232.                 {
  233.                     cout<<"Your entry must be between 0 and 8."<<endl;
  234.                     Pause();
  235.                 }
  236.                 if ((stime!=0)&&(stime>=0)&&(stime<=8))
  237.                 {
  238.                     cout<<"System is shutting down."<<endl;
  239.                     Pause();
  240.                     break;
  241.                 }
  242.             }
  243.         }
  244.         else if (Num==8)
  245.         {
  246.             system("shutdown -l");
  247.             cout<<"Logging off user."<<endl;
  248.             Pause();
  249.         }
  250.         else if (Num==9)
  251.         {
  252.         while (true)
  253.             {
  254.                 system("cls");
  255.                 cout<<"Select Restart Delay:"<<endl;
  256.                 cout<<"\t0:  Cancel"<<endl;
  257.                 cout<<"\t1:  No Delay"<<endl;
  258.                 cout<<"\t2:  5 Second Delay"<<endl;
  259.                 cout<<"\t3:  30 Second Delay"<<endl;
  260.                 cout<<"\t4:  1 Minute Delay"<<endl;
  261.                 cout<<"\t5:  5 Minute Delay"<<endl;
  262.                 cout<<"\t6:  30 Minute Delay"<<endl;
  263.                 cout<<"\t7:  1 Hour Delay"<<endl;
  264.                 cout<<"\t8:  1 Day Delay"<<endl;
  265.                 cout<<"Enter Your Choice: ";
  266.                 cin>>rtime;
  267.                 if (rtime==1)
  268.                     system("shutdown -r -t 0");
  269.                 else if (rtime==2)
  270.                     system("shutdown -r -t 5");
  271.                 else if (rtime==3)
  272.                     system("shutdown -r -t 30");
  273.                 else if (rtime==4)
  274.                     system("shutdown -r -t 60");
  275.                 else if (rtime==5)
  276.                     system("shutdown -r -t 300");
  277.                 else if (rtime==6)
  278.                     system("shutdown -r -t 1800");
  279.                 else if (rtime==7)
  280.                     system("shutdown -r -t 3600");
  281.                 else if (rtime==8)
  282.                     system("shutdown -r -t 86400");
  283.                 else if (rtime==0)
  284.                 {
  285.                     Pause();
  286.                     break;
  287.                 }
  288.                 else
  289.                 {
  290.                     cout<<"Your entry must be between 0 and 8."<<endl;
  291.                     Pause();
  292.                 }
  293.                 if ((rtime!=0)&&(rtime>=0)&&(rtime<=8))
  294.                 {
  295.                     cout<<"System is restarting."<<endl;
  296.                     Pause();
  297.                     break;
  298.                 }
  299.             }
  300.         }
  301.         else if (Num==10)
  302.         {
  303.             Xnum=0;
  304.             while ((PWEntered!=AbortPW)&&(Xnum<6))
  305.             {
  306.                 system("cls");
  307.                 cout<<"Enter the Password to Abort('x' to exit): ";
  308.                 cin>>PWEntered;
  309.                 if (PWEntered==AbortPW)
  310.                 {
  311.                     system("shutdown -a");
  312.                     cout<<"Shutdown Aborted."<<endl;
  313.                     Pause();
  314.                 }
  315.                 else if (PWEntered=="x")
  316.                 {
  317.                     Pause();
  318.                     break;
  319.                 }
  320.                 else
  321.                 {
  322.                     cout<<"The password you entered was incorrect."<<endl;
  323.                     Pause();
  324.                 }
  325.                 Xnum+=2;
  326.             }
  327.             if ((PWEntered!=AbortPW)&&(PWEntered!="x"))
  328.             {
  329.                 cout<<endl<<"You failed to enter the correct password."<<endl<<endl<<"GOODBYE"<<endl<<endl;
  330.                 return(0);
  331.             }
  332.         }
  333.         else if (Num==11)
  334.         {
  335.             cout<<"GOODBYE"<<endl<<endl;
  336.             break;
  337.         }
  338.         else if ((Num>11) || (Num<0))
  339.         {
  340.             cout<<"The number must be between 0 and 11."<<endl<<endl;
  341.             Pause();
  342.         }
  343.         }
  344.        
  345.     return(0);
  346. }
Advertisement
Add Comment
Please, Sign In to add comment