Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 26.14 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int coins = 0;
  8.     int fc = 1;
  9.     string work;
  10.     string parttime;
  11.     //shop
  12.     string shop;
  13.     string dshop;
  14.     string buy;
  15.     string job;
  16.     string testdummy;
  17.     string syntax;
  18.     string pf;
  19.     string nothing;
  20.     string richpenny;
  21.     string quad;
  22.     string math;
  23.     string typer;
  24.     string engineer;
  25.     //shop
  26.     //stats
  27.     int parttimeh = 0;
  28.     int parttimec = 0;
  29.     int parttimef = 0;
  30.     int dwork = 0;
  31.     int scoins = 0;
  32.     int mathd = 0;
  33.     int mathc = 0;
  34.     int mathf = 0;
  35.     int typerd = 0;
  36.     int typerc = 0;
  37.     int typerf = 0;
  38.     int engineerd = 0;
  39.     int engineerc = 0;
  40.     int engineerf = 0;
  41.     int items = 0;
  42.     //stats
  43.     cout << " Welcome to my test game" << endl << "Type PLAY to begin, CR for the credits," << endl << "and About for this game's description. Type EXIT anytime, anywhere to exit the game." << endl << endl;
  44.     string starting;
  45.     getline(cin, starting,'\n');
  46.     if ( starting == "play")
  47. /**< Here is where the actual game program starts */
  48.     {
  49.         while ( 1 < 10 )
  50.         {
  51.             cout << endl << endl << "Type your command. Type HELP for help, and HELPCMDS for commands you can use. I HIGHLY RECOMMEND YOU TO TYPE help IF YOU ARE NEW." << endl << endl;
  52.             string cmd;
  53.             getline(cin, cmd,'\n');
  54.             // COMMAND LINE
  55.             if ( cmd == "help" )
  56.             {
  57.                 cout << "If you need to type a command, type the EXACT command without any spaces or grammer problems. ONLY TYPE COMMANDS IN LOWERCASE LETTERS. Type HELP and then any command to get help on what that command does like this: helpwork. In the shop, NEVER buy a workjob or a showcaseitem multiple times because you can only claim them once, and if you do buy them multiple times, its your loss. You can buy boxes multiple times. Type commands exactly as you see in the shop.";
  58.             }
  59.             else if ( cmd == "helpcmds")
  60.             {
  61.                 cout << endl << endl << "List of commands:" << endl << endl << "exit, help, helpcmds, work, workjob, bal, stats, parttime, freecoin, shop, inv, getbox, nextpage, clear. Special commands: usebox" << endl << endl;
  62.             }
  63.             else if ( cmd == "exit")
  64.             {
  65.                 cout << "Are you sure you want to exit? you will lose ALL of your progress" << endl << "YES or NO" << endl << endl;
  66.                 string exit;
  67.                 getline(cin, exit,'\n');
  68.                 if ( exit == "yes")
  69.                 {
  70.                     return 0;
  71.                 }
  72.                 else
  73.                 {
  74.                     cout << endl << endl << endl;
  75.                 }
  76.             }
  77.             else if ( cmd == "nextpage")
  78.             {
  79.                 cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
  80.             }
  81.             else if ( cmd == "clear")
  82.             {
  83.                 cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
  84.             }
  85.             else if ( cmd == "freecoin")
  86.             {
  87.                 cout << "+1 coin";
  88.                 coins = coins + 1000;
  89.             }
  90.             else if ( cmd == "bal")
  91.             {
  92.                 cout << endl << endl << coins << " coins" <<  endl << endl;
  93.             }
  94.             else if ( cmd == "work")
  95.             {
  96.                 cout << endl;
  97.                 if ( job == "typer")
  98.                 {
  99.                    cout << "Type (this thing is very weird, this I am working as typer now, I should not cheat. This job is very eazy, use nitro type to learn to type) without parenthesis()" << endl << endl;
  100.                    getline(cin, work,'\n');
  101.                    if ( work == "this thing is very weird, this I am working as typer now, I should not cheat. This job is very eazy, use nitro type to learn to type")
  102.                    {
  103.                         cout << "+50 coins" << endl << endl;
  104.                         coins = coins + 50;
  105.                         dwork = dwork + 1;
  106.                         typerd = typerd + 1;
  107.                         typerc = typerc + 50;
  108.                    }
  109.                    else
  110.                    {
  111.                         cout << "sorry, but that is incorrect" << endl << endl;
  112.                         typerf = typerf + 1;
  113.                    }
  114.                 }
  115.                 else if ( job == "math")
  116.                 {
  117.                     cout << " Solve this math problem:" << endl << "268x84" << endl << "Type in the answer" << endl << endl;
  118.                     getline(cin, work,'\n');
  119.                     if ( work == "22,512" || work == "22512")
  120.                     {
  121.                         cout << "+25 coins" << endl << endl;
  122.                         coins = coins + 25;
  123.                         dwork = dwork + 1;
  124.                         mathd = mathd + 1;
  125.                         mathc = mathc + 25;
  126.                     }
  127.                     else
  128.                     {
  129.                         cout << "sorry, but that is incorrect" << endl << endl;
  130.                         mathf = mathf + 1;
  131.                     }
  132.                 }
  133.                 else if ( job == "engineer")
  134.                 {
  135.                     cout << "Retype this sentence but the blanks _ must be filled (don't type _ in your answer): " << endl << "a battery has a _ charge and a _ charge" << endl << endl;
  136.                     getline(cin, work,'\n');
  137.                     // ERROR IS IN HERE: (player can type anything and get freecoins)
  138.                     if ( work == "a battery has a positive charge and a negative charge")
  139.                     {//to here
  140.                         cout << "+100 coins" << endl << endl;
  141.                         coins = coins + 100;
  142.                         dwork = dwork + 1;
  143.                         engineerd = engineerd + 1;
  144.                         engineerc = engineerc + 100;
  145.                     }
  146.                     else if ( work == "a battery has a - charge and a + charge")
  147.                     {
  148.                         cout << "+100 coins" << endl << endl;
  149.                         coins = coins + 100;
  150.                         dwork = dwork + 1;
  151.                         engineerd = engineerd + 1;
  152.                         engineerc = engineerc + 100;
  153.                     }
  154.                     else if ( work == "a battery has a negative charge and a positive charge")
  155.                     {
  156.                         cout << "+100 coins" << endl << endl;
  157.                         coins = coins + 100;
  158.                         dwork = dwork + 1;
  159.                         engineerd = engineerd + 1;
  160.                         engineerc = engineerc + 100;
  161.                     }
  162.                     else if ( work == "a battery has a + charge and a - charge")
  163.                     {
  164.                         cout << "+100 coins" << endl << endl;
  165.                         coins = coins + 100;
  166.                         dwork = dwork + 1;
  167.                         engineerd = engineerd + 1;
  168.                         engineerc = engineerc + 100;
  169.                     }
  170.                     else
  171.                     {
  172.                         cout << "sorry, but that is incorrect" << endl << endl;
  173.                         engineerf = engineerf + 1;
  174.                     }
  175.                 }
  176.                 else if ( job == "programmer")
  177.                 {
  178.                     cout << "Type a C++ program that prints (Hello World)";
  179.                 }
  180.                 else
  181.                 {
  182.                     cout << endl << endl << "You currently don't have any job to work on. Get a workjob in the shop." << endl << endl;
  183.                 }
  184.             }
  185.             else if ( cmd == "parttime")
  186.             {
  187.                 cout << "Type (2948utrgjwouw4298q23th) without parenthesis" << endl << endl;
  188.                 getline(cin, parttime,'\n');
  189.                 if ( parttime == "2948utrgjwouw4298q23th")
  190.                 {
  191.                     cout << " +65 coins" << endl << endl;
  192.                     coins = coins + 65;
  193.                     parttimeh = parttimeh + 1;
  194.                     parttimec = parttimec + 65;
  195.                 }
  196.                 else
  197.                 {
  198.                     cout << " sorry, but that is incorrect" << endl << endl;
  199.                     parttimef = parttimef + 1;
  200.                 }
  201.             }
  202.             else if ( cmd == "shop")
  203.             {
  204.                 cout << endl << endl << "     SHOP:" << endl << "Type which category of the shop you want to go to: Workjobs, showcaseitems, boxes," << endl << endl;
  205.                 getline(cin, shop,'\n');
  206.                 if ( shop == "workjobs")
  207.                 {
  208.                     cout << endl << endl << "Type which job you are interested in buying: math, typer, engineer" << endl << endl;
  209.                     getline(cin, dshop,'\n');
  210.                     if ( dshop == "math")
  211.                     {
  212.                         cout << endl << endl << "Math: You need to solve a math problem to earn 25 coins" << endl << "do you want to purchase Math workjob for 10 coins?" << endl << "Type YES or NO" << endl << endl;
  213.                         getline(cin, buy,'\n');
  214.                         if ( buy == "yes" && coins > 9)
  215.                         {
  216.                             cout << "You have purchased the Math workjob" << endl << endl;
  217.                             coins = coins - 10;
  218.                             job = "math";;
  219.                             scoins = scoins + 10;
  220.                             math = "Math";
  221.                         }
  222.                         else if ( buy == "yes" && coins < 10)
  223.                         {
  224.                             cout << endl << endl << "sorry, but you do not have enough coins to make this purchase" << endl << endl;
  225.                         }
  226.                     }
  227.                     else if ( dshop == "typer")
  228.                     {
  229.                         cout << endl << endl << "Typer: You need to type a long sentence to earn 50 coins" << endl << "do you want to purchase Typer workjob for 100 coins?" << endl << "Type YES or NO" << endl << endl;
  230.                         getline(cin, buy,'\n');
  231.                         if ( buy == "yes" && coins > 119)
  232.                         {
  233.                             cout << "You have purchased the Typer workjob" << endl << endl;
  234.                             coins = coins - 120;
  235.                             job = "typer";
  236.                             scoins = scoins + 120;
  237.                             typer = "Typer";
  238.                         }
  239.                         else if ( buy == "yes" && coins < 120)
  240.                         {
  241.                             cout << endl << endl << "sorry, but you do not have enough coins to make this purchase" << endl << endl;
  242.                         }
  243.                     }
  244.                     else if ( dshop == "engineer")
  245.                     {
  246.                         cout << endl << endl << "Engineer: You need to solve a problem related to engineering to earn 90 coins" << endl << "do you want to purchase Engineer workjob for 260 coins?" << endl << "Type YES or NO" << endl << endl;
  247.                         getline(cin, buy,'\n');
  248.                         if ( buy == "yes" && coins > 259)
  249.                         {
  250.                             cout << "You have purchased the engineer workjob" << endl << endl;
  251.                             coins = coins - 260;
  252.                             job = "engineer";
  253.                             scoins = scoins + 260;
  254.                             engineer = "Engineer";
  255.                         }
  256.                         else if ( buy == "yes" && coins < 260)
  257.                         {
  258.                             cout << endl << endl << "sorry, but you do not have enough coins to make this purchase" << endl << endl;
  259.                         }
  260.                     }
  261.                     else
  262.                     {
  263.                         cout << "sorry, incorrect statement" << endl << endl;
  264.                     }
  265.                 }
  266.                 if ( shop == "showcaseitems")
  267.                 {
  268.                     cout << endl << endl << "Which type of item are you interested in buying: testdummy, syntax, peasantfeather, nothing, truerichpenny, 44QUAD44 (warning: showcase items are only cosmetics and don't affect gameplay)" << endl << endl;
  269.                     getline(cin, dshop,'\n');
  270.                     if ( dshop == "testdummy")
  271.                     {
  272.                         cout << "TestDummy. cost: 5 coins" << endl << "Want to purchase? Type Yes or NO" << endl;
  273.                         getline(cin, buy,'\n');
  274.                         if ( buy == "yes" && coins > 4)
  275.                         {
  276.                             cout << "TestDummy has been purchased" << endl << endl;
  277.                             testdummy = "TestDummy";
  278.                             coins = coins - 5;
  279.                             scoins = scoins + 5;
  280.                         }
  281.                         else if ( buy == "yes" && coins < 5)
  282.                         {
  283.                             cout << endl << endl << "sorry, but you do not have enough coins to make this purchase" << endl << endl;
  284.                         }
  285.                     }
  286.                     else if ( dshop == "syntax")
  287.                     {
  288.                         cout << "Syntax. cost: 50" << endl << "Want to purchase? Type YES or NO" << endl;
  289.                         getline(cin, buy,'\n');
  290.                         if ( buy == "yes" && coins > 49)
  291.                         {
  292.                             cout << "Syntax has been purchased" << endl << endl;
  293.                             syntax == "Syntax";
  294.                             coins = coins - 50;
  295.                             scoins = scoins + 50;
  296.                             if ( syntax == "Syntax")
  297.                             {
  298.                                 items = items + fc;
  299.                             }
  300.                         }
  301.                         else if ( buy == "yes" && coins < 50)
  302.                         {
  303.                             cout << endl << endl << "sorry, but you do not have enough coins to make this purchase" << endl << endl;
  304.                         }
  305.                     }
  306.                     else if ( dshop == "peasantfeather")
  307.                     {
  308.                         cout << "PeasantFeather. cost: 140" << endl << "Want to purchase? Type YES or NO" << endl;
  309.                         getline(cin, buy,'\n');
  310.                         if ( buy == "yes" && coins > 139)
  311.                         {
  312.                             cout << "PeasantFeather has been purchased" << endl << endl;
  313.                             pf == "PeasantFeather";
  314.                             coins = coins - 140;
  315.                             scoins = scoins + 140;
  316.  
  317.                         }
  318.                         else if ( buy == "yes" && coins < 140)
  319.                         {
  320.                             cout << endl << endl << "sorry, but you do not have enough coins to make this purchase" << endl << endl;
  321.                         }
  322.                     }
  323.                     else if ( dshop == "nothing")
  324.                     {
  325.                         cout << "Nothing. cost: 400" << endl << "Want to purchase? Type YES or NO" << endl;
  326.                         getline(cin, buy,'\n');
  327.                         if ( buy == "yes" && coins > 399)
  328.                         {
  329.                             cout << "Nothing has been purchased" << endl << endl;
  330.                             nothing == "Nothing";
  331.                             coins = coins - 400;
  332.                             scoins = scoins + 400;
  333.                         }
  334.                         else if ( buy == "yes" && coins < 400)
  335.                         {
  336.                             cout << endl << endl << "sorry, but you do not have enough coins to make this purchase" << endl << endl;
  337.                         }
  338.                     }
  339.                     else if ( dshop == "truerichpenny")
  340.                     {
  341.                         cout << "TrueRichPenny. cost: 999" << endl << "This item is ganna cost you a game-win, want to purchase? Type YES or NO" << endl;
  342.                         getline(cin, buy,'\n');
  343.                         if ( buy == "yes" && coins > 998)
  344.                         {
  345.                             cout << "TrueRichPenny has been purchased" << endl << endl;
  346.                             richpenny == "TrueRichPenny";
  347.                             coins = coins - 999;
  348.                             scoins = scoins + 999;
  349.                         }
  350.                         else if ( buy == "yes" && coins < 999)
  351.                         {
  352.                             cout << endl << endl << "sorry, but you do not have enough coins to make this purchase" << endl << endl;
  353.                         }
  354.                     }
  355.                     else if ( dshop == "44quad44")
  356.                     {
  357.                         cout << "44QUAD44, creator's fav number. cost: 4444" << endl << "Want to purchase? Type YES or NO" << endl;
  358.                         getline(cin, buy,'\n');
  359.                         if ( buy == "yes" && coins > 4443)
  360.                         {
  361.                             cout << "44QUAD44 has been purchased" << endl << endl;
  362.                             quad == "44QUAD44";
  363.                             coins = coins - 4444;
  364.                             scoins = scoins + 4444;
  365.                         }
  366.                         else if ( buy == "yes" && coins < 4444)
  367.                         {
  368.                             cout << endl << endl << "sorry, but you do not have enough coins to make this purchase" << endl << endl;
  369.                         }
  370.                     }
  371.                 }
  372.             }
  373.             else if ( cmd == "stats")
  374.             {
  375.                 cout << endl << endl << "     STATS:" << endl << endl << "you have " << coins << " coins (" << 1000 - coins << " more coins to win.) You have spent " << scoins << " coins." << endl << "Currently working as " << job << " with " << math << ", " << typer << ", " << engineer << " available work jobs. You have " << dwork << " total days of work and " << mathf + typerf + engineerf << " overall fails in all workjobs" << endl << "You have " << items << " items in your inventory" << endl << "You have " << mathd << " days of work in the Math workjob, earned " << mathc << " coins in Math workjob, and " << mathf << " fails in Math workjob." << endl << "You have " << typerd << " days of work in Typer workjob, earned " << typerc << " coins in Typer workjob, and have " << typerf << " fails in Typer workjob." << endl << "You have " << engineerd << " days of work in Engineer workjob, earned " << engineerc << " coins in Engineer workjob, and have " << engineerf << " fails in Engineer workjob." << endl << "You have " << parttimeh << " parttime hours, you have earned " << parttimec << " coins by doing parttime, and " << parttimef << " fails in parttime." << endl;
  376.             }
  377.             else if ( cmd == "workjob")
  378.             {
  379.                 cout << endl << endl << "What workjob do you want to change into? Type what workjob you want to change into like this: workjobtyper. You can only change into the workjob's you bought." << endl << endl;
  380.             }
  381.             else if ( cmd == "workjobmath")
  382.             {
  383.                 cout << endl << endl;
  384.                 if ( math == "Math")
  385.                 {
  386.                     cout << "You have changed to Math workjob." << endl << endl;
  387.                     job = "math";
  388.                 }
  389.                 else
  390.                 {
  391.                     cout << "You currently don't have this job." << endl << endl;
  392.                 }
  393.             }
  394.             else if ( cmd == "workjobtyper")
  395.             {
  396.                 cout << endl << endl;
  397.                 if ( typer == "Typer")
  398.                 {
  399.                     cout << "You have changed to Typer workjob." << endl << endl;
  400.                     job = "typer";
  401.                 }
  402.                 else
  403.                 {
  404.                     cout << "You currently don't have this job." << endl << endl;
  405.                 }
  406.             }
  407.             else if ( cmd == "workjobengineer")
  408.             {
  409.                 cout << endl << endl;
  410.                 if ( engineer == "Engineer")
  411.                 {
  412.                     cout << "You have changed to Engineer workjob." << endl << endl;
  413.                     job = "engineer";
  414.                 }
  415.                 else
  416.                 {
  417.                     cout << "You currently don't have this job." << endl << endl;
  418.                 }
  419.             }
  420.             else if ( cmd == "inv")
  421.             {
  422.                 cout << endl << endl << "            Your inventory:" << endl << endl << "You have " << items << " total items in your inventory";
  423.             }
  424.             //THESE NEED FIXING
  425.             else if ( testdummy == "TestDummy")
  426.             {
  427.                 items = items + 1;
  428.             }
  429.             else if ( pf == "PeasantFeather")
  430.             {
  431.                 items = items + 1;
  432.             }
  433.             else if ( nothing == "Nothing")
  434.             {
  435.                 items++;
  436.             }
  437.             else if ( richpenny == "TrueRichPenny")
  438.             {
  439.                 items = items + 1;
  440.             }
  441.             else if ( quad == "44QUAD44")
  442.             {
  443.                 items = items;
  444.             }
  445.             //THESE NEED FIXING
  446.             }
  447.             /**< ACTUAL GAME PROGRAM ENDS */
  448.     }
  449.     else if ( starting == "cr")
  450.     {
  451.         cout << endl << endl << "CREDITS:" << endl << endl;
  452.     }
  453.     else if ( starting == "about")
  454.     {
  455.         cout << endl << endl << "ABOUT:" << endl << endl << "In this game, you have to earn 10,000 coins to succeed. You can earn coins in many ways. You need to buy items in the shop to enhance your coin-earning. Sometimes, there are disasters and you lose some money" << endl << endl;
  456.     }
  457.     else if ( starting == "exit")
  458.     {
  459.         cout << "Are you sure you want to exit? You will lose all of your progress" << endl << "YES or NO" << endl << endl;
  460.         string exit;
  461.         getline(cin, exit,'\n');
  462.         if ( exit == "yes")
  463.         {
  464.             return 0;
  465.         }
  466.         else
  467.         {
  468.         cout << "sorry, invalid statement" << endl << endl;
  469.         }
  470.     }
  471. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement