oudavid1
12/22/2011, 07:18 PM
I made this :D
I would love for someone to find any flaws with it (because there are some).
I am really bored with no work/school and thought I would practice.
You will need a C++ compiler and Windows to run it.
#include <iostream>
#include <string>
#include <windows.h>
#include <conio.h>
#include <iomanip>
using namespace std;
int main (){
string first="st";
string second="nd";
string third="rd";
string forth="th";
string append;
string of;
char ballsign='s';
int ballon;
string gol ="";
turnover:
reset:
int down=1;
int distance=10;
int gainloss=0;
int tdyards;
int i=0;
int ndown;
int ndistance;
char nballsign;
int nballon;
system("cls");
cout << "\n\n\n\n\n\n\n\n\n\nWhat yardline is the ball on?" <<endl;
cin >> ballsign;
if (ballsign =='r'){
goto reset;
}
cin >> ballon;
system("cls");
if (ballsign =='+' && ballon <= 10)
{
distance = ballon;
}
system("cls");
append = first;
//if turnover 1st and goal
goto output;
begin:
cin >> gol;
if (gol =="r"){
goto reset;
}
if (gol =="c"){
goto correction;
}
if (gol =="to"){
goto turnover;
}
if (gol =="td"){
touchdown:
system("cls");
if (ballsign =='-'){
tdyards = 100 - ballon;
}
else {
tdyards = ballon;
}
ballsign ='+';
ballon =3;
cout << fixed
<< setw(37) <<"Previous Play: "<<"Touchdown of " <<tdyards <<" yards" <<endl
<<" " <<"------------------------------------" <<endl
<<" "
<< setw(5)<< "Down"
<< setw(10)<< "Distance"
<< setw(12)<< "Ball On"
<<endl;
cout <<" "
<< setw(9)<< "PAT"
<< setw(8)<< "PAT"
<< setw(10)<< ballsign << ballon
<<endl
<<" " <<"------------------------------------" <<endl
<<endl;
cin.get();
cin.get();
system("cls");
goto turnover;
}
if (gol == "b"){
goto newballon;
}
//if (gol != "b" || "td" || "gain" || "loss" || "r" || "c" || "to"){
//system("cls");
//cout << "Invalid input, press any key to reset the program..." <<endl;
//cin.get();
//cin.get();
//goto reset;
//}
cin >> of;
cin >> gainloss;
//cout << of << gainloss <<endl;
//system("pause");
system("cls");
//if gain
if (gol == "gain")
{
if (gainloss < distance)
{ down ++;
if (ballsign =='+')
{
ballon=ballon-gainloss;
distance = distance - gainloss;
if(ballon < 1){
goto touchdown;
goto turnover;
}
}
//if ballsign is -
else {
ballon=ballon + gainloss;
distance = distance - gainloss;
if (ballon > 50){
ballsign='+';
ballon=100-ballon;
}
}
}
//gainloss > distance
else {
down=1;
distance =10;
if (ballsign =='-'){
ballon=gainloss + ballon;
}
else {
ballon = ballon - gainloss;
if(ballon < 1){
goto touchdown;
goto turnover;
}
}
if (ballon > 50)
{
ballsign ='+';
ballon = ballon-50;
ballon = 50-ballon;
if(ballon < 1){
goto touchdown;
goto turnover;
}
}
//cout << "ballon is "<< ballon << endl;
//goal to go
if (ballsign =='+' && ballon <= 9)
{
distance = ballon;
if(ballon < 1){
goto touchdown;
goto turnover;
}
}
}
}
//if loss
if (gol == "loss")
{
down ++;
distance = distance + gainloss;
if(ballsign =='+')
{
ballon = ballon+gainloss;
if (ballon > 50)
{
ballsign ='-';
ballon = 100-ballon;
}
}
else
{
ballon = ballon - gainloss;
}
}
correction:
while (gol == "c" && i < 1)
{system("cls");
cout << "****CORRECTION****" <<endl;
cout << "enter down" <<endl;
cin >> ndown;
cout << "enter distance" <<endl;
cin >> ndistance;
cout << "enter ball on" <<endl;
cin >> nballsign;
cin >> nballon;
system("cls");
if (ndown ==0){
down =down;
}
else {down = ndown;}
if (ndistance ==0){
distance = distance;
}
else {distance = ndistance;}
if (nballsign==0 || nballon ==0){
ballsign = ballsign;
ballon = ballon;
}
else {ballon=nballon; ballsign = nballsign;}
i++;
newballon:
if (gol == "b")
{system("cls");
cout << "New Ballspot?" <<endl;
cin >> nballsign >> nballon;
if (nballsign =='+' && ballsign=='-'){
gol = "gain";
of = "of";
gainloss = (100 - (ballon + nballon));
}
if (nballsign =='-' && ballsign=='+'){
gol = "loss";
of = "of";
gainloss = (100 - (ballon + nballon));
}
if (nballsign =='+' && ballsign=='+' && nballon < ballon){
gol = "gain";
of = "of";
gainloss = (ballon - nballon);
}
if (nballsign =='+' && ballsign=='+' && nballon > ballon){
gol = "loss";
of = "of";
gainloss = (nballon - ballon);
}
if (nballsign =='-' && ballsign=='-' && nballon > ballon){
gol = "gain";
of = "of";
gainloss = (nballon - ballon);
}
if (nballsign =='-' && ballsign=='-' && nballon < ballon){
gol = "loss";
of = "of";
gainloss = (ballon - nballon);
}
ballsign= nballsign;
ballon = nballon;
if (gol =="gain" && gainloss < distance)
{down ++;
distance = distance -gainloss;
}
if (gol =="gain" && gainloss > distance && (ballsign !='+' && ballon <= 10))
{down =1;
distance =10;
}
if (gol =="gain" && gainloss > distance && (ballsign =='+' && ballon <= 10) && distance != ballon)
{down =1;
distance =ballon;
}
if (gol =="loss")
{down ++;
distance = distance + gainloss;
}
}
}
if (down ==1)
{append = first;
}
if (down ==2)
{append = second;
}
if (down ==3)
{append = third;
}
if (down ==4)
{append = forth;
}
if (gol =="c")
{gol ="";
gainloss=0;
}
output:
system("cls");
if (ballsign =='+' && ballon==distance)
{
//if (gol != "gain" || "loss")
//{
// gol = " ";
// of = " ";
// gainloss = 0;
//}
cout << fixed
<< setw(40) <<" Previous Play: "<<gol <<" " << of << " "<<gainloss <<" yards" <<endl
<<" "
<<"------------------------------------" <<endl
<<" "
<< setw(5)<< "Down"
<< setw(10)<< "Distance"
<< setw(12)<< "Ball On"
<<endl;
cout <<" "
<< setw(7)<< down <<append
<< setw(8)<< "Goal"
<< setw(10)<< ballsign << ballon
<<endl
<<" "
<<"------------------------------------" <<endl
<<endl;
}
else
{
cout << fixed
<< setw(40) <<" Previous Play: "<<gol <<" " << of << " "<<gainloss <<" yards" <<endl
<<" "
<<"------------------------------------" <<endl
<<" "
<< setw(5)<< "Down"
<< setw(10)<< "Distance"
<< setw(12)<< "Ball On"
<<endl;
cout <<" "
<< setw(7)<< down <<append
<< setw(8)<< distance
<< setw(10)<< ballsign << ballon
<<endl
<<" "
<<"------------------------------------" <<endl
<<endl;
}
cout << "\n\n\n\n\n\n\n\n\n\nWhat happened on the previous play? \nPress 'r' to Reset Program\nPress 'c' for Corrections\nPress 'b' for new ballspot" <<endl;
//cout << ballsign <<endl;
while (down <=4){
goto begin;
}
system("pause");
}
I would love for someone to find any flaws with it (because there are some).
I am really bored with no work/school and thought I would practice.
You will need a C++ compiler and Windows to run it.
#include <iostream>
#include <string>
#include <windows.h>
#include <conio.h>
#include <iomanip>
using namespace std;
int main (){
string first="st";
string second="nd";
string third="rd";
string forth="th";
string append;
string of;
char ballsign='s';
int ballon;
string gol ="";
turnover:
reset:
int down=1;
int distance=10;
int gainloss=0;
int tdyards;
int i=0;
int ndown;
int ndistance;
char nballsign;
int nballon;
system("cls");
cout << "\n\n\n\n\n\n\n\n\n\nWhat yardline is the ball on?" <<endl;
cin >> ballsign;
if (ballsign =='r'){
goto reset;
}
cin >> ballon;
system("cls");
if (ballsign =='+' && ballon <= 10)
{
distance = ballon;
}
system("cls");
append = first;
//if turnover 1st and goal
goto output;
begin:
cin >> gol;
if (gol =="r"){
goto reset;
}
if (gol =="c"){
goto correction;
}
if (gol =="to"){
goto turnover;
}
if (gol =="td"){
touchdown:
system("cls");
if (ballsign =='-'){
tdyards = 100 - ballon;
}
else {
tdyards = ballon;
}
ballsign ='+';
ballon =3;
cout << fixed
<< setw(37) <<"Previous Play: "<<"Touchdown of " <<tdyards <<" yards" <<endl
<<" " <<"------------------------------------" <<endl
<<" "
<< setw(5)<< "Down"
<< setw(10)<< "Distance"
<< setw(12)<< "Ball On"
<<endl;
cout <<" "
<< setw(9)<< "PAT"
<< setw(8)<< "PAT"
<< setw(10)<< ballsign << ballon
<<endl
<<" " <<"------------------------------------" <<endl
<<endl;
cin.get();
cin.get();
system("cls");
goto turnover;
}
if (gol == "b"){
goto newballon;
}
//if (gol != "b" || "td" || "gain" || "loss" || "r" || "c" || "to"){
//system("cls");
//cout << "Invalid input, press any key to reset the program..." <<endl;
//cin.get();
//cin.get();
//goto reset;
//}
cin >> of;
cin >> gainloss;
//cout << of << gainloss <<endl;
//system("pause");
system("cls");
//if gain
if (gol == "gain")
{
if (gainloss < distance)
{ down ++;
if (ballsign =='+')
{
ballon=ballon-gainloss;
distance = distance - gainloss;
if(ballon < 1){
goto touchdown;
goto turnover;
}
}
//if ballsign is -
else {
ballon=ballon + gainloss;
distance = distance - gainloss;
if (ballon > 50){
ballsign='+';
ballon=100-ballon;
}
}
}
//gainloss > distance
else {
down=1;
distance =10;
if (ballsign =='-'){
ballon=gainloss + ballon;
}
else {
ballon = ballon - gainloss;
if(ballon < 1){
goto touchdown;
goto turnover;
}
}
if (ballon > 50)
{
ballsign ='+';
ballon = ballon-50;
ballon = 50-ballon;
if(ballon < 1){
goto touchdown;
goto turnover;
}
}
//cout << "ballon is "<< ballon << endl;
//goal to go
if (ballsign =='+' && ballon <= 9)
{
distance = ballon;
if(ballon < 1){
goto touchdown;
goto turnover;
}
}
}
}
//if loss
if (gol == "loss")
{
down ++;
distance = distance + gainloss;
if(ballsign =='+')
{
ballon = ballon+gainloss;
if (ballon > 50)
{
ballsign ='-';
ballon = 100-ballon;
}
}
else
{
ballon = ballon - gainloss;
}
}
correction:
while (gol == "c" && i < 1)
{system("cls");
cout << "****CORRECTION****" <<endl;
cout << "enter down" <<endl;
cin >> ndown;
cout << "enter distance" <<endl;
cin >> ndistance;
cout << "enter ball on" <<endl;
cin >> nballsign;
cin >> nballon;
system("cls");
if (ndown ==0){
down =down;
}
else {down = ndown;}
if (ndistance ==0){
distance = distance;
}
else {distance = ndistance;}
if (nballsign==0 || nballon ==0){
ballsign = ballsign;
ballon = ballon;
}
else {ballon=nballon; ballsign = nballsign;}
i++;
newballon:
if (gol == "b")
{system("cls");
cout << "New Ballspot?" <<endl;
cin >> nballsign >> nballon;
if (nballsign =='+' && ballsign=='-'){
gol = "gain";
of = "of";
gainloss = (100 - (ballon + nballon));
}
if (nballsign =='-' && ballsign=='+'){
gol = "loss";
of = "of";
gainloss = (100 - (ballon + nballon));
}
if (nballsign =='+' && ballsign=='+' && nballon < ballon){
gol = "gain";
of = "of";
gainloss = (ballon - nballon);
}
if (nballsign =='+' && ballsign=='+' && nballon > ballon){
gol = "loss";
of = "of";
gainloss = (nballon - ballon);
}
if (nballsign =='-' && ballsign=='-' && nballon > ballon){
gol = "gain";
of = "of";
gainloss = (nballon - ballon);
}
if (nballsign =='-' && ballsign=='-' && nballon < ballon){
gol = "loss";
of = "of";
gainloss = (ballon - nballon);
}
ballsign= nballsign;
ballon = nballon;
if (gol =="gain" && gainloss < distance)
{down ++;
distance = distance -gainloss;
}
if (gol =="gain" && gainloss > distance && (ballsign !='+' && ballon <= 10))
{down =1;
distance =10;
}
if (gol =="gain" && gainloss > distance && (ballsign =='+' && ballon <= 10) && distance != ballon)
{down =1;
distance =ballon;
}
if (gol =="loss")
{down ++;
distance = distance + gainloss;
}
}
}
if (down ==1)
{append = first;
}
if (down ==2)
{append = second;
}
if (down ==3)
{append = third;
}
if (down ==4)
{append = forth;
}
if (gol =="c")
{gol ="";
gainloss=0;
}
output:
system("cls");
if (ballsign =='+' && ballon==distance)
{
//if (gol != "gain" || "loss")
//{
// gol = " ";
// of = " ";
// gainloss = 0;
//}
cout << fixed
<< setw(40) <<" Previous Play: "<<gol <<" " << of << " "<<gainloss <<" yards" <<endl
<<" "
<<"------------------------------------" <<endl
<<" "
<< setw(5)<< "Down"
<< setw(10)<< "Distance"
<< setw(12)<< "Ball On"
<<endl;
cout <<" "
<< setw(7)<< down <<append
<< setw(8)<< "Goal"
<< setw(10)<< ballsign << ballon
<<endl
<<" "
<<"------------------------------------" <<endl
<<endl;
}
else
{
cout << fixed
<< setw(40) <<" Previous Play: "<<gol <<" " << of << " "<<gainloss <<" yards" <<endl
<<" "
<<"------------------------------------" <<endl
<<" "
<< setw(5)<< "Down"
<< setw(10)<< "Distance"
<< setw(12)<< "Ball On"
<<endl;
cout <<" "
<< setw(7)<< down <<append
<< setw(8)<< distance
<< setw(10)<< ballsign << ballon
<<endl
<<" "
<<"------------------------------------" <<endl
<<endl;
}
cout << "\n\n\n\n\n\n\n\n\n\nWhat happened on the previous play? \nPress 'r' to Reset Program\nPress 'c' for Corrections\nPress 'b' for new ballspot" <<endl;
//cout << ballsign <<endl;
while (down <=4){
goto begin;
}
system("pause");
}