1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
|
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
void treasury(long int &M);
void game(string &PN, string &CN, long int &M, long int &HC, double &TXR);
int save(string &PN, string &CN, long int &M, long int &HC, double &TXR);
void NatManager(long int &M, long int &HC, double &TXR);
void MnthDeduct(long int &M, long int &HC, double &TXR);
int main()
{
int choice;
long int money = 1000000000;
string Pname;
string Cname;
long int hCare = 0;
double taxRate = 0;
cout << "1) New" << endl;
cout << "2) Load" << endl;
cin >> choice;
switch(choice)
{
case 1:
{
cin.sync();
cout << "Welcome please enter your name" << endl;
getline(cin, Pname);
cout << "\n";
cin.sync();
cout << "Thank you " << Pname << " now please enter your countries name." << endl;
getline(cin, Cname);
cout << "Welcome " << Pname << " to " << Cname << endl;
cout << "Press ENTER to continue\n" << endl;
cin.get();
save(Pname, Cname, money, hCare, taxRate);
}
break;
case 2:
{
ifstream file("President.txt");
getline(file, Pname);
getline(file, Cname);
file >> money;
file >> hCare;
file >> taxRate;
game(Pname,Cname,money,hCare,taxRate);
}
break;
default:
cout << "Error" << endl;
}
}
void game(string &PN, string &CN, long int &M, long int &HC, double &TXR)
{
int choice;
cout << "What will you do?\n" << endl;
cout << "1) Go to Treasury" << endl;
cout << "2) Go to Nation Manager" << endl;
cout << "3) View monthly deductions" << endl;
cout << "4) Save" << endl;
cin >> choice;
switch(choice)
{
case 1:
treasury(M);
break;
case 2:
NatManager(M, HC, TXR);
break;
case 3:
MnthDeduct(M, HC, TXR);
break;
case 4:
save(PN,CN,M,HC,TXR);
break;
}
}
void treasury(long int &M)
{
cout << "NATIONAL TREASURY\n" << endl;
cout << "Current money in treasury: " << M << endl;
}
int save(string &PN, string CN, long int &M, long int &HC, double &TXR)
{
ofstream file;
file.open("President.txt");
file << PN << endl;
file << CN << endl;
file << M << endl;
file << HC << endl;
file << TXR << endl;
file.close();
return game(PN,CN,M,HC,TXR);
}
void NatManager(long int &M, long int &HC, double &TXR)
{
int choice;
long int healC = 0;
double taxR = 0;
cout << "What do you want to do here?\n" << endl;
cout << "1) Modify Healthcare" << endl;
cout << "2) Modify Taxes" << endl;
cout << "3) Pass/veto bills" << endl;
cin >> choice;
cout << "\n";
switch(choice)
{
case 1:
cout << "MODIFY HEALTHCARE\n" << endl;
cout << "Current Healthcare budget: $" << HC << endl;
cout << "What would you like to change the budget to?" << endl;
cout << "Current Government Budget: $" << M << endl;
cin >> healC;
if(healC < M)
{
HC = healC;
cout << "\n";
cout << "Ok current Healthcare budget is set to: $" << HC << endl;
cout << "Current National budget: $" << M - healC << endl;
}
else if(healC > M)
{
cout << "Thats more money than you have!" << endl;
}
break;
case 2:
cout << "MODIFY TAXES\n" << endl;
cout << "Current Tax Rate: %" << TXR << endl;
cout << "What would you like to change the Tax Rate to?" << endl;
cin >> taxR;
cout << "\n";
TXR = taxR;
cout << "Ok the current tax rate is now: %" << TXR << endl;
}
}
void MnthDeduct(long int &M, long int &HC, double &TXR)
{
cout << "MONTHLY DEDUCTIBLE\n" << endl;
cout << M << "" << HC << "" << TXR << endl;
}
void Variables()
{
long int money = 1000000000;
string Pname;
string Cname;
long int hCare = 0;
double taxRate = 0;
}
|