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 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
|
#include <iostream>
#include <string>
#include <stdlib.h> // needed for exit (0);
int error = 0;
int input = 0;
int error2 = 0;
int stop;
int patiencetest = 20000;
int patiencetest2 = 1000; // CODE LOOKS GOOD END
using namespace std;
int addition (int x, int y)
{
int r;
r=x+y;
return (r);
}
int subtraction (int a, int b)
{
int c;
c=a-b;
return (c);
}
int multiplication (int d, int e)
{
int f;
f=d*e;
return (f);
}
int division (int g, int h)
{
int i;
i=g/h;
return (i);
}
void sniper()
{
cout<<"Information loading...\n";
}
void printmessage()
{
cout<<"Error: error has occured and program must close down.\n";
}
bool iskeypressed()
{
return WaitForSingleObject(
GetStdHandle( STD_INPUT_HANDLE ),
0
) == WAIT_OBJECT_0;
}
int main()
{
CHECKPOINT1:
int z; // CODE LOOKS GOOD BEGIN
int result = 0;
z = addition (5, 3); // 5+3
sniper();
cout<<"What do you think the result will be?\n";
cout<<"1. 1-10\n2. 11-20\n3. 21-30\n4. 31-40\n5. 41-50\n6. A negative\n7. A positive above 50\n";
cin>>result;
switch (result)
{
case 1:
cout<<"The result is " << z; // result of addition (5, 3)
break;
case 2:
cout<<"The result is " << z; // result of addition (5, 3)
break;
case 3:
cout<<"The result is " << z; // result of addition (5, 3)
break;
case 4:
cout<<"The result is " << z; // result of addition (5, 3)
break;
case 5:
cout<<"The result is " << z; // result of addition (5, 3)
break;
case 6:
cout<<"The result is " << z; // result of addition (5, 3)
break;
case 7:
cout<<"The result is " << z; // result of addition (5, 3)
break;
default:
printmessage();
error2 = 1;
break;
}
while (error2 == 1)
system("pause");
cout<<"\n"; // newline
cout<<"\n\n\n\n\t\tAbout to begin the patience test.\n";
cout<<"\n\n\n\n\t\tIf you want to stop this early, enter the number '24'.";
cout<<"\n\n\n\n\t\tEnter any number to begin.\n"; // requests number input
cin>>input;
int beginning = 20000;
int beginninghelp = 0;
for (int beginning = 20000; beginninghelp < beginning; beginninghelp++)
{
if (input == 0)
{
cout<<"0 ";
}
if (input == 1)
{
cout<<"1 ";
}
if (input == 2)
{
cout<<"2 ";
}
if (input == 3)
{
cout<<"3 ";
}
if (input == 4)
{
cout<<"4 ";
}
if (input == 5)
{
cout<<"5 ";
}
if (input == 6)
{
cout<<"6 ";
}
if (input == 24)
{
cout<<"Program stopped.\n";
cout<<"\n\n\n\n\t\tEnter \"1\" to restart program.\n\n\n\n\t\tEnter \"2\" to exit entire program.\n\n\n\n\t\tEnter \"3\" \
to skip to end of patience test.\n\n\n\n\t\tEnter \"4\" to go to the code being worked on (if stopearly == 24)";
cin>>stop;
if (stop == 1)
goto CHECKPOINT1;
if (stop == 2)
exit (0);
if (stop == 3)
goto CHECKPOINT2;
break;
if (stop == 4)
goto CHECKPOINT3;
break;
}
if (input > 6)
{
cout<<"7 8 9 ";
}
iskeypressed();
}
CHECKPOINT3:
cin.get();
cout<<"\n\n\n\n\t\tBeginning patience test...\n";
system("pause");
for (int error = 0; error <= patiencetest; error++)
{
cout << ".";
if (error == patiencetest)
{
CHECKPOINT2:
cout<<"Congratulations! You've passed the patience test. As you've been taught, it's always good to \
wait to see if anything else happens before continuing on.\n";
error = patiencetest;
}
}
cout<<"\n";
cin.get();
if ( error < patiencetest)
{
cout<<"NOTE: Error has not been saved to its previous integer numerical value. We are currently unsure of \
how to fix this problem.\n";
cout<<" Error equals: ";
cout << error;
cout<<"\n";
}
string rebegin;
getline(cin, rebegin);
if (rebegin == "restart")
{
goto CHECKPOINT1;
cin.get();
}
cin.get();
}
|