Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define UP_ARROW 72
- #define DOWN_ARROW 80
- #define RIGHT_ARROW 77
- #include <iostream>
- #include <conio.h>
- #include<iostream>
- #include<time.h>
- #include<cstdlib>
- #include<fstream>
- #define _WIN32_WINNT 0x0500
- #include <windows.h>
- #include <Wincon.h>
- #include <string>
- #include <algorithm>
- #include <iostream>
- #include <iomanip>
- #include <algorithm>
- #include <cctype>
- #include <dos.h>
- #include <conio.h>
- #include "Objidl.h"
- #include <iostream>
- #include <string>
- #include "shlwapi.h"
- #include <dos.h>
- #define WIN32_LEAN_AND_MEAN
- #define WIN32_EXTRA_LEAN
- using namespace std;
- int Money, Month, Season, Menu, ButtonPress, Bills, TotalStock;
- int ElectronicsS, ElectronicsD, ElectronicsP, ChocolatesS, ChocolatesD, ChocolatesP, ToolsS, ToolsD, ToolsP, BeachS, BeachD, BeachP, ClothesS, ClothesD, ClothesP,BackS ,BackD ,BackP, Electronics,Chocolates,Tools,Back,Beach,Clothes, Buying;
- int ElectronicsA, ChocolatesA, ToolsA, BeachA, ClothesA, BackA, Spare;
- char KeyStroke;
- int GetRandNumber(int Lowest, int Range)
- {
- srand (time(NULL));
- int geez = rand ()% Range + Lowest;
- return geez;
- }
- int GetInput()
- {
- KeyStroke = getch();
- if (KeyStroke == 0 || KeyStroke == -32)
- {
- KeyStroke = getch();
- switch (KeyStroke)
- {
- case UP_ARROW:
- return 1;
- break;
- case DOWN_ARROW:
- return 2;
- break;
- case RIGHT_ARROW:
- return 3;
- break;
- }
- }
- }
- int GetSeason ()
- {
- switch (Month)
- {
- case 1:
- return 4;
- break;
- case 2:
- return 4;
- break;
- case 3:
- return 1;
- break;
- case 4:
- return 1;
- break;
- case 5:
- return 1;
- break;
- case 6:
- return 2;
- break;
- case 7:
- return 2;
- break;
- case 8:
- return 2;
- break;
- case 9:
- return 3;
- break;
- case 10:
- return 3;
- break;
- case 11:
- return 4;
- break;
- }
- }
- void PrintSeason()
- {
- switch(Season)
- {
- case 1:
- cout << "Spring";
- break;
- case 2:
- cout << "Summer";
- break;
- case 3:
- cout << "Autumn";
- break;
- case 4:
- cout << "Winter";
- break;
- }
- }
- void PrintStuff()
- {
- cout << "\t\t\t\t\t\t";
- SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), 0xE4 );
- cout << "Month:" << Month << " Money:" << Money << " Current Season:";
- PrintSeason();
- cout << " Total Stocks:" << TotalStock << endl;
- SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), 0x07 );
- cout << "\t\t\t\t\t\t" << endl;
- }
- void WhatsInDemand()
- {
- int Season = GetSeason();
- switch (Season)
- {
- case 1:
- cout << "Chocolates and gardening tools are currently in high demand" << endl;
- break;
- case 2:
- cout << "Beach equipment is in high demand, back to school and warm clothing are in low demand." << endl;
- break;
- case 3:
- cout << "Back to school is currently in high demand, beach equipment is low" << endl;
- break;
- case 4:
- cout << "Electronics and warm clothes are high, garden tools and beach equipment are low" << endl;
- break;
- }
- }
- int MenuScreen()
- {
- int x = 1;
- Lawl:
- PrintStuff();
- if (x < 1)
- {
- x = 10;
- }
- if (x > 10)
- {
- x = 1;
- }
- switch(x)
- {
- case 1:
- cout << ">Buy Electronics and Gifts " << endl;
- cout << "Buy Chocolate " << endl;
- cout << "Buy Gardening tools " << endl;
- cout << "Buy Back to school equipment " << endl;
- cout << "Buy Beach toys " << endl;
- cout << "Buy Warm Clothes " << endl;
- cout << "View Stats " << endl;
- cout << "Exit " << endl;
- cout << "Next month " << endl;
- cout << "View help" << endl;
- cout << endl << endl << endl;
- WhatsInDemand();
- ButtonPress = GetInput();
- switch (ButtonPress)
- {
- case 1:
- x--;
- break;
- case 2:
- x++;
- break;
- case 3:
- return 1;
- }
- goto hah;
- case 2:
- cout << "Buy Electronics and Gifts " << endl;
- cout << ">Buy Chocolate " << endl;
- cout << "Buy Gardening tools " << endl;
- cout << "Buy Back to school equipment " << endl;
- cout << "Buy Beach toys " << endl;
- cout << "Buy Warm Clothes " << endl;
- cout << "View Stats " << endl;
- cout << "Exit " << endl;
- cout << "Next month " << endl;
- cout << "View help" << endl;
- cout << endl << endl << endl;
- WhatsInDemand();
- ButtonPress = GetInput();
- switch (ButtonPress)
- {
- case 1:
- x--;
- break;
- case 2:
- x++;
- break;
- case 3:
- return 2;
- }
- goto hah;
- case 3:
- cout << "Buy Electronics and Gifts " << endl;
- cout << "Buy Chocolate " << endl;
- cout << ">Buy Gardening tools " << endl;
- cout << "Buy Back to school equipment " << endl;
- cout << "Buy Beach toys " << endl;
- cout << "Buy Warm Clothes " << endl;
- cout << "View Stats " << endl;
- cout << "Exit " << endl;
- cout << "Next month " << endl;
- cout << "View help" << endl;
- cout << endl << endl << endl;
- WhatsInDemand();
- ButtonPress = GetInput();
- switch(ButtonPress)
- {
- case 1:
- x--;
- break;
- case 2:
- x++;
- break;
- case 3:
- return 3;
- }
- goto hah;
- case 4:
- cout << "Buy Electronics and Gifts " << endl;
- cout << "Buy Chocolate " << endl;
- cout << "Buy Gardening tools " << endl;
- cout << ">Buy Back to school equipment " << endl;
- cout << "Buy Beach toys " << endl;
- cout << "Buy Warm Clothes " << endl;
- cout << "View Stats " << endl;
- cout << "Exit " << endl;
- cout << "Next month " << endl;
- cout << "View help" << endl;
- cout << endl << endl << endl;
- WhatsInDemand();
- ButtonPress = GetInput();
- switch(ButtonPress)
- {
- case 1:
- x--;
- break;
- case 2:
- x++;
- break;
- case 3:
- return 4;
- }
- goto hah;
- case 5:
- cout << "Buy Electronics and Gifts " << endl;
- cout << "Buy Chocolate " << endl;
- cout << "Buy Gardening tools " << endl;
- cout << "Buy Back to school equipment " << endl;
- cout << ">Buy Beach toys " << endl;
- cout << "Buy Warm Clothes " << endl;
- cout << "View Stats " << endl;
- cout << "Exit " << endl;
- cout << "Next month " << endl;
- cout << "View help" << endl;
- cout << endl << endl << endl;
- WhatsInDemand();
- ButtonPress = GetInput();
- switch(ButtonPress)
- {
- case 1:
- x--;
- break;
- case 2:
- x++;
- break;
- case 3:
- return 5;
- }
- goto hah;
- case 6:
- cout << "Buy Electronics and Gifts " << endl;
- cout << "Buy Chocolate " << endl;
- cout << "Buy Gardening tools " << endl;
- cout << "Buy Back to school equipment " << endl;
- cout << "Buy Beach toys " << endl;
- cout << ">Buy Warm Clothes " << endl;
- cout << "View Stats " << endl;
- cout << "Exit " << endl;
- cout << "Next month " << endl;
- cout << "View help" << endl;
- cout << endl << endl << endl;
- WhatsInDemand();
- ButtonPress = GetInput();
- switch(ButtonPress)
- {
- case 1:
- x--;
- break;
- case 2:
- x++;
- break;
- case 3:
- return 6;
- }
- goto hah;
- case 7:
- cout << "Buy Electronics and Gifts " << endl;
- cout << "Buy Chocolate " << endl;
- cout << "Buy Gardening tools " << endl;
- cout << "Buy Back to school equipment " << endl;
- cout << "Buy Beach toys " << endl;
- cout << "Buy Warm Clothes " << endl;
- cout << ">View Stats " << endl;
- cout << "Exit " << endl;
- cout << "Next month " << endl;
- cout << "View help" << endl;
- cout << endl << endl << endl;
- WhatsInDemand();
- ButtonPress = GetInput();
- switch(ButtonPress)
- {
- case 1:
- x--;
- break;
- case 2:
- x++;
- break;
- case 3:
- return 7;
- }
- goto hah;
- case 8:
- cout << "Buy Electronics and Gifts " << endl;
- cout << "Buy Chocolate " << endl;
- cout << "Buy Gardening tools " << endl;
- cout << "Buy Back to school equipment " << endl;
- cout << "Buy Beach toys " << endl;
- cout << "Buy Warm Clothes " << endl;
- cout << "View Stats " << endl;
- cout << ">Exit " << endl;
- cout << "Next month " << endl;
- cout << "View help" << endl;
- cout << endl << endl << endl;
- WhatsInDemand();
- ButtonPress = GetInput();
- switch(ButtonPress)
- {
- case 1:
- x--;
- break;
- case 2:
- x++;
- break;
- case 3:
- return 8;
- }
- goto hah;
- case 9:
- cout << "Buy Electronics and Gifts " << endl;
- cout << "Buy Chocolate " << endl;
- cout << "Buy Gardening tools " << endl;
- cout << "Buy Back to school equipment " << endl;
- cout << "Buy Beach toys " << endl;
- cout << "Buy Warm Clothes " << endl;
- cout << "View Stats " << endl;
- cout << "Exit " << endl;
- cout << ">Next month " << endl;
- cout << "View help" << endl;
- cout << endl << endl << endl;
- WhatsInDemand();
- ButtonPress = GetInput();
- switch(ButtonPress)
- {
- case 1:
- x--;
- break;
- case 2:
- x++;
- break;
- case 3:
- return 9;
- }
- goto hah;
- case 10:
- cout << "Buy Electronics and Gifts " << endl;
- cout << "Buy Chocolate " << endl;
- cout << "Buy Gardening tools " << endl;
- cout << "Buy Back to school equipment " << endl;
- cout << "Buy Beach toys " << endl;
- cout << "Buy Warm Clothes " << endl;
- cout << "View Stats " << endl;
- cout << "Exit " << endl;
- cout << "Next month " << endl;
- cout << ">View help" << endl;
- cout << endl << endl << endl;
- WhatsInDemand();
- ButtonPress = GetInput();
- switch(ButtonPress)
- {
- case 1:
- x--;
- break;
- case 2:
- x++;
- break;
- case 3:
- return 10;
- }
- hah:
- system("CLS");
- goto Lawl;
- }
- }
- void CalcDemand()
- {
- Season = GetSeason();
- switch (Season)
- {
- case 1:
- ElectronicsD = 3;
- ChocolatesD = 6;
- ToolsD = 6;
- BackD = 4;
- BeachD = 4;
- ClothesD = 4;
- break;
- case 2:
- ElectronicsD = 4;
- ChocolatesD = 5;
- ToolsD = 4;
- BackD = 2;
- BeachD = 7;
- ClothesD = 2;
- break;
- case 3:
- ElectronicsD = 4;
- ChocolatesD = 5;
- ToolsD = 5;
- BackD = 7;
- BeachD = 2;
- ClothesD = 5;
- break;
- case 4:
- ElectronicsD = 7;
- ChocolatesD = 5;
- ToolsD = 2;
- BackD = 4;
- BeachD = 2;
- ClothesD = 7;
- break;
- }
- }
- void CalcPrices()
- {
- CalcDemand();
- Spare = GetRandNumber(16,2);
- ElectronicsP = ElectronicsD * Spare;
- Spare = GetRandNumber(4,2);
- ChocolatesP = ChocolatesD * Spare;
- Spare = GetRandNumber(7,3);
- ToolsP = ToolsD * Spare;
- Spare = GetRandNumber(6,2);
- BackP = BackD * Spare;
- Spare = GetRandNumber(5,3);
- BeachP = BeachD * Spare;
- Spare = GetRandNumber(16,2);
- ClothesP = ClothesD * Spare;
- }
- void CalcSpeed()
- {
- CalcDemand();
- ElectronicsS = ElectronicsD * GetRandNumber(12,3);
- ChocolatesS = ChocolatesD * GetRandNumber(15,4);
- ToolsS = ToolsD * GetRandNumber(13,3);
- BackS = BackD * GetRandNumber(13,3);
- BeachS = BeachD * GetRandNumber(13,3);
- ClothesS = ClothesD * GetRandNumber(15,3);
- }
- int main ()
- {
- HWND hWnd = GetConsoleWindow();
- ShowWindow(hWnd,SW_SHOWMAXIMIZED);
- HANDLE hOut;
- COORD NewSBSize;
- SMALL_RECT Area = {0, 0, 0, 0};
- hOut = GetStdHandle(STD_OUTPUT_HANDLE);
- NewSBSize = GetLargestConsoleWindowSize(hOut);
- SetConsoleScreenBufferSize(hOut, NewSBSize);
- Area.Right = NewSBSize.X - 1;
- Area.Bottom = NewSBSize.Y - 1;
- SetConsoleWindowInfo(hOut, TRUE, &Area);
- Money = 50000;
- Month = 1;
- Electronics,Chocolates,Tools,Back,Beach,Clothes = 0;
- cout << "I would highly reccomend reading the help file if this is your first time playing!" << endl;
- Start:
- TotalStock = Electronics + Chocolates + Tools + Back + Beach + Clothes;
- Season = GetSeason();
- CalcDemand();
- CalcSpeed();
- CalcPrices();
- int Menu = MenuScreen();
- switch(Menu)
- {
- case 1:
- Electronics:
- system("CLS");
- PrintStuff();
- cout << "How much electronics stock would you like to buy?" << endl << "Electronics are currently " << ElectronicsP <<", so you can buy at max " << Money / ElectronicsP << endl << ">";
- cin >> Buying;
- if (Buying * ElectronicsP > Money)
- {
- cout << endl << "You don't have enough money to do that!" << endl;
- goto Electronics;
- }
- Electronics = Electronics + Buying;
- Money = Money - (Buying * ElectronicsP);
- cout << "You bought " << Buying << " for " << ElectronicsP * Buying << "!" << endl;
- system("PAUSE");
- break;
- case 2:
- Chocolates:
- system("CLS");
- PrintStuff();
- cout << "How much Chocolates stock would you like to buy?" << endl << "Chocolates are currently " << ChocolatesP <<", so you can buy at max " << Money / ChocolatesP << endl << ">";
- cin >> Buying;
- if (Buying * ChocolatesP > Money)
- {
- cout << endl << "You don't have enough money to do that!" << endl;
- goto Chocolates;
- }
- Chocolates = Chocolates + Buying;
- Money = Money - (Buying * ChocolatesP);
- cout << "You bought " << Buying << " for " << ChocolatesP * Buying << "!" << endl;
- system("PAUSE");
- break;
- case 3:
- Tools:
- system("CLS");
- PrintStuff();
- cout << "How much Tools stock would you like to buy?" << endl << "Tools are currently " << ToolsP <<", so you can buy at max " << Money / ToolsP << endl << ">";
- cin >> Buying;
- if (Buying * ToolsP > Money)
- {
- cout << endl << "You don't have enough money to do that!" << endl;
- goto Tools;
- }
- Tools = Tools + Buying;
- Money = Money - (Buying * ToolsP);
- cout << "You bought " << Buying << " for " << ToolsP * Buying << "!" << endl;
- system("PAUSE");
- break;
- case 4:
- Back:
- system("CLS");
- PrintStuff();
- cout << "How much Back to school stock would you like to buy?" << endl << "Back to school stocks are currently " << BackP <<", so you can buy at max " << Money / BackP << endl << ">";
- cin >> Buying;
- if (Buying * BackP > Money)
- {
- cout << endl << "You don't have enough money to do that!" << endl;
- goto Back;
- }
- Back = Back + Buying;
- Money = Money - (Buying * BackP);
- cout << "You bought " << Buying << " for " << BackP * Buying << "!" << endl;
- system("PAUSE");
- break;
- case 5:
- Beach:
- system("CLS");
- PrintStuff();
- cout << "How much Beach stock would you like to buy?" << endl << "Beach equipment stocks are currently " << BeachP <<", so you can buy at max " << Money / BeachP << endl << ">";
- cin >> Buying;
- if (Buying * BeachP > Money)
- {
- cout << endl << "You don't have enough money to do that!" << endl;
- goto Beach;
- }
- Beach = Beach + Buying;
- Money = Money - (Buying * BeachP);
- cout << "You bought " << Buying << " for " << BeachP * Buying << "!" << endl;
- system("PAUSE");
- break;
- case 6:
- Clothes:
- system("CLS");
- PrintStuff();
- cout << "How much Clothes stock would you like to buy?" << endl << "Clothes equipment stocks are currently " << ClothesP <<", so you can buy at max " << Money / ClothesP << endl << ">";
- cin >> Buying;
- if (Buying * ClothesP > Money)
- {
- cout << endl << "You don't have enough money to do that!" << endl;
- goto Clothes;
- }
- Clothes = Clothes + Buying;
- Money = Money - (Buying * ClothesP);
- cout << "You bought " << Buying << " for " << ClothesP * Buying << "!" << endl;
- system("PAUSE");
- break;
- case 7:
- system("CLS");
- PrintStuff();
- cout << "\tStocks:" << endl;
- cout << "Electronics stock:\t" << Electronics << endl;
- cout << "Chocolate stock:\t" << Chocolates << endl;
- cout << "Gardening stock:\t" << Tools << endl;
- cout << "Stationary stock:\t" << Back << endl;
- cout << "Beach stock:\t\t" << Beach << endl;
- cout << "Warm clothes stock:\t" << Clothes << endl << endl << endl;
- cout << "\tPrices:" << endl;
- cout << "Electronics stock prices:\t" << ElectronicsP << endl;
- cout << "Chocolate stock prices:\t\t" << ChocolatesP << endl;
- cout << "Gardening stock prices:\t\t" << ToolsP << endl;
- cout << "Stationary stock prices:\t" << BackP << endl;
- cout << "Beach stock prices:\t\t" << BeachP << endl;
- cout << "Warm clothes stock prices:\t" << ClothesP << endl << endl << endl;
- WhatsInDemand();
- system("PAUSE");
- break;
- case 8:
- system("PAUSE");
- return 0;
- case 9:
- system("CLS");
- Month++;
- PrintStuff();
- cout << "Monthly report:" << endl;
- if (ElectronicsS> Electronics)
- {
- Money = Money + (Electronics * ElectronicsP) + (ElectronicsD * 3);
- cout << "You sold all your electronics stock!" << endl;
- Electronics = 0;
- goto AElectronics;
- }
- Electronics = Electronics - (ElectronicsS);
- cout << "You sold " << ElectronicsS << " electronics stock, leaving you with " << Electronics << endl;
- Money = Money + (ElectronicsS * ElectronicsP);
- AElectronics:
- if (ChocolatesS> Chocolates)
- {
- Money = Money + (Chocolates * ChocolatesP);
- cout << "You sold all your Chocolates stock!" << endl;
- Chocolates = 0;
- goto AChocolates;
- }
- Chocolates = Chocolates - (ChocolatesS);
- cout << "You sold " << ChocolatesS << " Chocolates stock, leaving you with " << Chocolates << endl;
- Money = Money + (ChocolatesS * ChocolatesP);
- AChocolates:
- if (ToolsS> Tools)
- {
- Money = Money + (Tools * ToolsP);
- cout << "You sold all your Gardening Tools stock!" << endl;
- Tools = 0;
- goto ATools;
- }
- Tools = Tools - (ToolsS);
- cout << "You sold " << ToolsS << " of your gardening tools stock, leaving you with " << Tools << endl;
- Money = Money + (ToolsS * ToolsP);
- ATools:
- if (BackS> Back)
- {
- Money = Money + (Back * BackP);
- cout << "You sold all your Back to school stock!" << endl;
- Back = 0;
- goto ABack;
- }
- Back = Back - (BackS);
- cout << "You sold " << BackS << " Back to school stock, leaving you with " << Back << endl;
- Money = Money + (BackS * BackP);
- ABack:
- if (BeachS> Beach)
- {
- Money = Money + (Beach * BeachP);
- cout << "You sold all your Beach stock!" << endl;
- Beach = 0;
- goto ABeach;
- }
- Beach = Beach - (BeachS);
- cout << "You sold " << BeachS << " Beach stock, leaving you with " << Beach << endl;
- Money = Money + (BeachS + BeachP);
- ABeach:
- if (ClothesS> Clothes)
- {
- Money = Money + (Clothes * ClothesP);
- cout << "You sold all your Clothes stock!" << endl;
- Clothes = 0;
- goto AClothes;
- }
- Clothes = Clothes - (ClothesS);
- cout << "You sold " << ClothesS << " Clothes stock, leaving you with " << Clothes << endl;
- Money = Money + (ClothesS * ClothesP);
- AClothes:
- cout << endl << "You paid " << 100 + (TotalStock/2) << " in bills!" << endl;
- Money = Money - (100 + (TotalStock/2));
- system("PAUSE");
- break;
- case 10:
- system("START C:\\quake\\Help.txt"); // Folder was open
- break;
- }
- system("CLS");
- goto Start;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment