Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //A REAL MAN NEVER COMMENTS HIS CODE
- #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 Chance, YN, Money, LobsterPots, Inshore, Outshore, Profit, Buying, HMoney, PotPrice, Lobsters, LobsterPrice, LobsterCatch, Selling, TotalLobsters;
- int DaysG = 7;
- char Name[260], HName[260], Date[9],Time[10];
- void PrintStuff()
- {
- cout << "\t\t\t\t\t\t";
- SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), 0xE4 );
- cout << "Days Left:" << DaysG << " Money:" << Money << " Pots:" << LobsterPots << " Lobsters:" << Lobsters << " Current high score: $" << HMoney << " (Held by " << HName<< ")";
- SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), 0x07 );
- cout << "\t\t\t\t\t\t" << endl;
- }
- void Pause()
- {
- system("PAUSE");
- }
- 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 = 50;
- LobsterPots = 10;
- TotalLobsters = 0;
- srand ( time(NULL) );
- ofstream FileO;
- ifstream FileI;
- FileI.open("HighScores.lob");
- FileI >> HName >> HMoney;
- FileI.close();
- HANDLE hStdout;
- hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
- cout << "Insert your name:" << endl << "> ";
- cin.getline(Name,260);
- system("CLS");
- cout << endl << endl << endl << endl << endl << endl;
- SetConsoleTextAttribute(hStdout, FOREGROUND_RED);
- cout << "\t\t\t\t\t\t /$$ /$$ /$$ " << endl;
- cout << "\t\t\t\t\t\t| $$ | $$ | $$ " << endl;
- cout << "\t\t\t\t\t\t| $$ /$$$$$$ | $$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ " << endl;
- cout << "\t\t\t\t\t\t| $$ /$$__ $$| $$__ $$ /$$_____/|_ $$_/ /$$__ $$ /$$__ $$" << endl;
- cout << "\t\t\t\t\t\t| $$ | $$ \\ $$| $$ \\ $$| $$$$$$ | $$ | $$$$$$$$| $$ \\__/" << endl;
- cout << "\t\t\t\t\t\t| $$ | $$ | $$| $$ | $$ \\____ $$ | $$ /$$| $$_____/| $$ " << endl;
- cout << "\t\t\t\t\t\t| $$$$$$$$| $$$$$$/| $$$$$$$/ /$$$$$$$/ | $$$$/| $$$$$$$| $$ " << endl;
- cout << "\t\t\t\t\t\t|________/ \\______/ |_______/ |_______/ \\___/ \\_______/|__/ " << endl;
- cout << "\t\t\t\t\t\t " << endl;
- cout << "\t\t\t " << endl;
- cout << "\t\t\t " << endl;
- cout << "\t\t\t\t\t\t /$$$$$$$ /$$ " << endl;
- cout << "\t\t\t\t\t\t| $$__ $$ | $$ " << endl;
- cout << "\t\t\t\t\t\t| $$ \\ $$ /$$$$$$ /$$$$$$ /$$$$$$$ " << endl;
- cout << "\t\t\t\t\t\t| $$$$$$$//$$__ $$|_ $$_/ /$$_____/ " << endl;
- cout << "\t\t\t\t\t\t| $$____/| $$ \\ $$ | $$ | $$$$$$ " << endl;
- cout << "\t\t\t\t\t\t| $$ | $$ | $$ | $$ /$$\\____ $$ " << endl;
- cout << "\t\t\t\t\t\t| $$ | $$$$$$/ | $$$$//$$$$$$$/ " << endl;
- cout << "\t\t\t\t\t\t|__/ \\______/ \\___/ |_______/ " << endl;
- cout << "\t\t\t\t\t\t " << endl;
- cout << "\t\t\t\t\t\t /$$$$$$$ " << endl;
- cout << "\t\t\t\t\t\t| $$__ $$ " << endl;
- cout << "\t\t\t\t\t\t| $$ \\ $$ /$$ /$$ " << endl;
- cout << "\t\t\t\t\t\t| $$$$$$$ | $$ | $$ " << endl;
- cout << "\t\t\t\t\t\t| $$__ $$| $$ | $$ " << endl;
- cout << "\t\t\t\t\t\t| $$ \\ $$| $$ | $$ " << endl;
- cout << "\t\t\t\t\t\t| $$$$$$$/| $$$$$$$ " << endl;
- cout << "\t\t\t\t\t\t|_______/ \\____ $$ " << endl;
- cout << "\t\t\t\t\t\t /$$ | $$ " << endl;
- cout << "\t\t\t\t\t\t | $$$$$$/ " << endl;
- cout << "\t\t\t\t\t\t \\______/ " << endl;
- cout << "\t\t\t\t\t\t /$$$$$$ /$$ /$$ /$$ " << endl;
- cout << "\t\t\t\t\t\t /$$__ $$| $$ | $$ | $$ " << endl;
- cout << "\t\t\t\t\t\t| $$ \\ $$| $$$$$$$ /$$$$$$$ /$$ /$$| $$ " << endl;
- cout << "\t\t\t\t\t\t| $$$$$$$$| $$__ $$ /$$__ $$| $$ | $$| $$ " << endl;
- cout << "\t\t\t\t\t\t| $$__ $$| $$ \\ $$| $$ | $$| $$ | $$| $$ " << endl;
- cout << "\t\t\t\t\t\t| $$ | $$| $$ | $$| $$ | $$| $$ | $$| $$ " << endl;
- cout << "\t\t\t\t\t\t| $$ | $$| $$$$$$$/| $$$$$$$| $$$$$$/| $$ " << endl;
- cout << "\t\t\t\t\t\t|__/ |__/|_______/ \\_______/ \\______/ |__/ " << endl;
- cout << "\t\t\t\t\t\t " << endl;
- cout << "\t\t\t\t\t\t " << endl;
- cout << "\t\t\t\t\t\t " << endl;
- cout << "\t\t\t\t\t\t /$$$$$$ /$$ /$$ " << endl;
- cout << "\t\t\t\t\t\t /$$__ $$| $$ |__/ " << endl;
- cout << "\t\t\t\t\t\t| $$ \\__/| $$$$$$$ /$$$$$$ /$$$$$$$ /$$ " << endl;
- cout << "\t\t\t\t\t\t| $$ /$$$$| $$__ $$ |____ $$| $$__ $$| $$ " << endl;
- cout << "\t\t\t\t\t\t| $$|_ $$| $$ \\ $$ /$$$$$$$| $$ \\ $$| $$ " << endl;
- cout << "\t\t\t\t\t\t| $$ \\ $$| $$ | $$ /$$__ $$| $$ | $$| $$ " << endl;
- cout << "\t\t\t\t\t\t| $$$$$$/| $$ | $$ | $$$$$$$| $$ | $$| $$ " << endl;
- cout << "\t\t\t\t\t\t \\______/ |__/ |__/ \\_______/|__/ |__/|__/ " << endl;
- Sleep(5000);
- Pause();
- hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
- SetConsoleTextAttribute(hStdout, FOREGROUND_RED);
- system("CLS");
- for (int Days = 7; Days > 0; Days --)
- {
- PrintStuff();
- Chance = rand () % 100 + 1;
- YN = rand () % 100 + 1;
- PotPrice = rand () % 15 + 10;
- LobsterCatch = rand () % 4 + 5;
- LobsterPrice = rand () % 15 + 10;
- Choice:
- if (Days == 1)
- {
- cout << "This is your last day! Use it wisely!" << endl;
- }
- cout << "There is a " << Chance << "% chance of a storm today." << endl;
- cout << "How many pots do you want to put inshore?" << endl << "> ";
- cin >> Inshore;
- Outshore = LobsterPots - Inshore;
- cout << "You are putting " << Inshore << " pots inshore and " << Outshore << " pots outshore." << endl;
- Sleep(3246);
- if (YN <= Chance)
- {
- if (Outshore == 0)
- {
- cout << "Good choice! It was stormy!" << endl;
- goto Calc;
- break;
- }
- cout << "It was stormy! You lost " << Outshore << " pots. Unlucky!" << endl;
- LobsterPots = LobsterPots - Outshore;
- Outshore = 0;
- }
- if (YN > Chance)
- {
- cout << "The weather was fine!";
- if (Outshore == 0)
- {
- cout << " Should have put more outshore!";
- }
- cout << endl;
- }
- Calc:
- Profit = (Inshore * 2) + (Outshore * LobsterCatch);
- TotalLobsters = TotalLobsters + (Inshore * 2) + (Outshore * LobsterCatch);
- Lobsters = Lobsters + Profit;
- system("PAUSE");
- system("CLS");
- PrintStuff();
- cout << "You caught " << Profit << " lobsters during that round. Your total amount of lobsters is " << Lobsters << endl;
- Take2:
- cout << "Today lobsters are selling at " << LobsterPrice << " a lobster. How many would you like to sell? (If you don't like the price, you can wait)" << endl << ">";
- cin >> Selling;
- if (Selling > Lobsters)
- {
- cout << endl << "You don't have that many lobsters, silly!";
- goto Take2;
- }
- if (Selling == 0)
- {
- cout << "Prices not good enough for you then?" << endl;
- goto Buy;
- }
- cout << "You sold " << Selling << " lobsters for " << LobsterPrice << " each, making " << (Selling * LobsterPrice) << "!" << endl << "You now have " << Lobsters - Selling << " lobsters and $" << Money + (Selling * LobsterPrice) << " dollars left." << endl;
- Money = Money + (Selling * LobsterPrice);
- Lobsters = Lobsters - Selling;
- Buy:
- system("PAUSE");
- system("CLS");
- PrintStuff();
- if (Days == 1)
- {
- break;
- }
- cout << "You can buy lobster pots at " << PotPrice << " a pot." << endl;
- if (Money < PotPrice)
- {
- cout << "You don't have enough money to buy any pots. Lol!" << endl;
- goto End;
- }
- cout << "How many would you like to buy? (You can buy " << Money/PotPrice << " pots)" << endl << "> ";
- cin >> Buying;
- if ((Buying * PotPrice) > Money)
- {
- cout << "Sorry, but you don't have enough money to do that" << endl;
- goto Buy;
- }
- if (Buying == 0)
- {
- cout << "Well thanks for wasting my time!" << endl;
- goto End;
- }
- Money = Money - (Buying * PotPrice);
- LobsterPots = LobsterPots + Buying;
- cout << "You bought " << Buying << " pots for $" << Buying * PotPrice << ". You have $" << Money << " left, and "<< LobsterPots << " pots." << endl;
- End:
- system("PAUSE");
- system("CLS");
- DaysG--;
- }
- system("CLS");
- cout << "Thats your week! Your pots will sell for $5 each and your lobsters will sell for $7 each, which gives you $" << LobsterPots * 5 + (Lobsters * 7) << endl;
- Money = Money + (LobsterPots * 5) + (Lobsters * 7);
- cout << "You finish off with $" << Money << "." << endl;
- if (Money > HMoney)
- {
- cout << endl << "You beat the high score!" << endl;
- FileO.open("HighScores.lob");
- FileO << Name << endl << Money;
- FileO.close();
- }
- else
- {
- cout << endl << "Sorry, but you didn't beat the high score :(" << endl;
- }
- _strdate_s(Date);
- _strtime(Time);
- FileO.open("Log.txt", ios::app);
- FileO << "Name: " << Name << endl << "Money: " << Money << endl << "Total amount of lobsters caught: " << TotalLobsters << endl << "Time and date: " << Date << ", " << Time << endl;
- if (Money > HMoney)
- {
- FileO << "High score beaten! Previous high score: " << HMoney << ", new high score: " << Money;
- }
- FileO << endl << endl;
- FileO.close();
- system("PAUSE");
- return 0; // done
- }
Advertisement
Add Comment
Please, Sign In to add comment