Run-time Execution - Assert Failure

A

August1

i'm having difficulties with the execution of a program, i believe due
to something i am missing in the copy constructor implementation. When
i create one object of the class and run the program with that object
alone, there are no problems. however, when subsequently using the
copy constructor for a second object and/or a third object created on
the heap memory - i run into an execution problem and assert failure
dialog box (ignore, retry, abort).

the program simulates scores in a football game using an overloaded
unary prefix increment operator and overloaded increment postfix
operator. the prefix opr. increments an int variable by 6 (touchdown
and no PAT), the postfix opr. increments the variable by 7 (touchdown
and PAT). a private static int variable is used to keep track of the
number of touchdowns scored by all teams, i.e. other instances of the
class where the increment operators are used. however, the score
continues to accumulate from the previous objects' score total (note:
this is different from the static TD counter).

i have looked over the code, but this is something i am not familiar
with. can anyone readily identify the problem?
thanks as always,
anthony

//footballgame.h interface file
#if !defined(FOOTBALLGAME_H)
#define FOOTBALLGAME_H

class FootballGame
{
public:

FootballGame(void); //default constructor declaration
//parameterized constructor declaration
FootballGame(char* szName, char* szCity, char* szQB, char* szMascot);
FootBallGame(const FootballGame&); //copy constructor declaration
~FootballGame(void); //destructor declaration
FootballGame& operator = (const FootballGame&);//overloaded assignment
operator void operator++(); //prefix unary operator declaration
void operator++(int);//postfix unary operator declaration
void addFG();
void addSafety();
void add2PointConv();
void setTeamName(char* szName);
char* getTeamName() const;
void setCity(char* szCity);
char* getCity() const;
void setQB(char* szQB);
char* getQB() const;
void setMascot(char* szMascot);
char* getMascot() const;
static int getNumTDs();
int getScore() const;
private:
int iScore;
static int iNumTDs;
char* szTeamName;
char* szCityName;
char* szQBName;
char* szMascotName;
};//end class FootballGame

#endif


//footballgame.cpp implementation file
#include "footballgame.h"
#include <cstring>

int FootballGame::iNumTDs = 0;//intialize global static variable

FootballGame::FootballGame(void)
{//default constructor definition
szTeamName = new char[25];
strcpy(szTeamName,"");
szCityName = new char[25];
strcpy(szCityName,"");
szQBName = new char[25];
strcpy(szQBName,"");
szMascotName = new char[25];
strcpy(szMascotName,"");
iScore = 0;
}

FootballGame::FootballGame(char* szName, char* szCity, char* szQB,
char* szMascot)
{//parameterized constructor definition
szTeamName = new char[25];
strcpy(szTeamName,szName);
szCityName = new char[25];
strcpy(szCityName,szCity);
szQBName = new char[25];
strcpy(szQBName,szQB);
szMascotName = new char[25];
strcpy(szMascotName,szMascot);
iScore = 0;
}

FootballGame::FootBallGame(const FootballGame& sourceTeam)
{//copy constructor definition
szTeamName = new char[25];
strcpy(szTeamName,sourceTeam.szTeamName);
szCityName = new char[25];
strcpy(szCityName,sourceTeam.szCityName);
szQBName = new char[25];
strcpy(szQBName,sourceTeam.szQBName);
szMascotName = new char[25];
strcpy(szMascotName,sourceTeam.szMascotName);

iScore = sourceTeam.iScore;
iScore = 0;
}

FootballGame::~FootballGame(void)
{//destructor deinition
delete[] szTeamName;
delete[] szCityName;
delete[] szQBName;
delete[] szMascotName;
}

FootballGame& FootballGame::eek:perator = (const FootballGame& operand)
{//defines overloaded assignment operator
if(this == &operand)
return *this;
else
{
szTeamName = new char[25];
strcpy(szTeamName,operand.szTeamName);
szCityName = new char[25];
strcpy(szCityName,operand.szCityName);
szQBName = new char[25];
strcpy(szQBName,operand.szQBName);
szMascotName = new char[25];
strcpy(szMascotName,operand.szMascotName);

iScore = operand.iScore;
iScore = 0;
return *this;
}
}

void FootballGame::eek:perator ++()
{//defines prefix overloaded unary increment operator
iScore += 6;
iNumTDs = iNumTDs + 1;
}

void FootballGame::eek:perator ++(int iScores)
{//defines postfix overloaded unary increment operator
iScore += 7;
iNumTDs = iNumTDs + 1;
}

void FootballGame::add2PointConv()
{
iScore += 2;
}

void FootballGame::addFG()
{
iScore += 3;
}

void FootballGame::addSafety()
{
iScore += 2;
}

void FootballGame::setCity(char* szCity)
{
strcpy(szCityName,szCity);
}

char* FootballGame::getCity() const
{
return szCityName;
}

void FootballGame::setMascot(char* szMascot)
{
strcpy(szMascotName,szMascot);
}

char* FootballGame::getMascot() const
{
return szMascotName;
}

void FootballGame::setQB(char* szQB)
{
strcpy(szQBName,szQB);
}

char* FootballGame::getQB() const
{
return szQBName;
}

void FootballGame::setTeamName(char* szName)
{
strcpy(szTeamName,szName);
}

char* FootballGame::getTeamName() const
{
return szTeamName;
}

int FootballGame::getScore() const
{
return iScore;
}

int FootballGame::getNumTDs()
{/*static function to return num of all TDs for all objects
of class where a team scores a TD*/
return iNumTDs;
}


//football.cpp user(client) source file
#include <iostream>
#include "footballgame.h"
using namespace std;

int main(void)
{
FootballGame game("Carolina Panthers", "Charlotte",
"Delhomme", "Sir Purr");

cout << "Team: " << game.getTeamName() << endl;
cout << "Mascot: " << game.getMascot() << endl;
cout << "Quarterback: " << game.getQB() << endl;
cout << "City: " << game.getCity() << endl;

++game; //calls prefix overloaded unary increment operator
cout << game.getScore() << endl;
++game;
cout << game.getScore() << endl;
++game;
game.add2PointConv();
cout << game.getScore() << endl;
game++; //calls postfix overloaded unary increment operator
cout << game.getScore() << endl;
game++;
cout << game.getScore() << endl;
game.addFG();
cout << game.getScore() << endl;
game.addSafety();
cout << game.getScore() << endl;
cout << "Number of touchdowns: " << game.getNumTDs() << endl;

//Problems occur here with use of stack object and then heap object
////////////////////////////////////////////////////////////////////
FootballGame cowboys(game);
cowboys.setTeamName("Dallas Cowboys");cowboys.setQB("Aiken");
cowboys.setCity("Dallas");cowboys.setMascot("Cheerleaders");
cout << cowboys.getTeamName() << endl;
cout << cowboys.getQB() << endl;
cout << cowboys.getCity() << endl;
cout << cowboys.getMascot() << endl;

cowboys++;
cout << cowboys.getScore() << endl;
cowboys++;
cout << cowboys.getScore() << endl;
cowboys.addFG();
cout << cowboys.getScore() << endl;
cout << cowboys.getNumTDs() << endl;

FootballGame* rams = new FootballGame;
rams->setTeamName("L.A. Rams");rams->setQB("Flutie");
rams->setCity("Los Angeles");rams->setMascot("Rambo");
cout << rams->getTeamName() << endl;
cout << rams->getQB() << endl;
cout << rams->getCity() << endl;
cout << rams->getMascot() << endl;

rams++;
rams->addFG();
++rams;
rams->add2PointConv();
cout << rams->getScore() << endl;
cout << FootballGame::getNumTDs() << endl;

delete rams;
//////////////////////////////////////////////////////////////////////

return EXIT_SUCCESS;
}//end main
 
J

John Harrison

August1 said:
i'm having difficulties with the execution of a program, i believe due
to something i am missing in the copy constructor implementation. When
i create one object of the class and run the program with that object
alone, there are no problems. however, when subsequently using the
copy constructor for a second object and/or a third object created on
the heap memory - i run into an execution problem and assert failure
dialog box (ignore, retry, abort).

[snip]


i have looked over the code, but this is something i am not familiar
with. can anyone readily identify the problem?

You should pay more attention to the warning messages your compiler gives
you.
thanks as always,
anthony

//footballgame.h interface file
#if !defined(FOOTBALLGAME_H)
#define FOOTBALLGAME_H

class FootballGame
{
public:

FootballGame(void); //default constructor declaration
//parameterized constructor declaration
FootballGame(char* szName, char* szCity, char* szQB, char* szMascot);
FootBallGame(const FootballGame&); //copy constructor declaration

Look very carefuly at the line above!!!

FootballGame(const FootballGame&); //copy constructor declaration

This is how it should be, see the difference? You were NOT declareing a copy
constructor just a function with a very similar name to the copy
constructor. You have similar problems where you actually define the copy
constructor too.

You also have some different problems further on

FootballGame* rams = new FootballGame;
rams->setTeamName("L.A. Rams");rams->setQB("Flutie");
rams->setCity("Los Angeles");rams->setMascot("Rambo");
cout << rams->getTeamName() << endl;
cout << rams->getQB() << endl;
cout << rams->getCity() << endl;
cout << rams->getMascot() << endl;

rams++;
rams->addFG();
++rams;
rams->add2PointConv();
cout << rams->getScore() << endl;
cout << FootballGame::getNumTDs() << endl;

delete rams;

Not sure what you are trying to do here but

rams++;
rams->addFG();

is an illegal use of a pointer. It would be OK if rams was pointing to an
array of at least two FootballGames but it isn't.

john
 
A

August1

John Harrison said:
August1 said:
i'm having difficulties with the execution of a program, i believe due
to something i am missing in the copy constructor implementation. When
i create one object of the class and run the program with that object
alone, there are no problems. however, when subsequently using the
copy constructor for a second object and/or a third object created on
the heap memory - i run into an execution problem and assert failure
dialog box (ignore, retry, abort).

[snip]


i have looked over the code, but this is something i am not familiar
with. can anyone readily identify the problem?

You should pay more attention to the warning messages your compiler gives
you.
thanks as always,
anthony

//footballgame.h interface file
#if !defined(FOOTBALLGAME_H)
#define FOOTBALLGAME_H

class FootballGame
{
public:

FootballGame(void); //default constructor declaration
//parameterized constructor declaration
FootballGame(char* szName, char* szCity, char* szQB, char* szMascot);
FootBallGame(const FootballGame&); //copy constructor declaration

Look very carefuly at the line above!!!

FootballGame(const FootballGame&); //copy constructor declaration

This is how it should be, see the difference? You were NOT declareing a copy
constructor just a function with a very similar name to the copy
constructor. You have similar problems where you actually define the copy
constructor too.

You also have some different problems further on

FootballGame* rams = new FootballGame;
rams->setTeamName("L.A. Rams");rams->setQB("Flutie");
rams->setCity("Los Angeles");rams->setMascot("Rambo");
cout << rams->getTeamName() << endl;
cout << rams->getQB() << endl;
cout << rams->getCity() << endl;
cout << rams->getMascot() << endl;

rams++;
rams->addFG();
++rams;
rams->add2PointConv();
cout << rams->getScore() << endl;
cout << FootballGame::getNumTDs() << endl;

delete rams;

Not sure what you are trying to do here but

rams++;
rams->addFG();

is an illegal use of a pointer. It would be OK if rams was pointing to an
array of at least two FootballGames but it isn't.

john

hi john,

hope that all is well. i had to go outside, smile, and take a deep
breath when considering the observation signified. this allowed what
was intended once amended.
Not sure what you are trying to do here but

rams++;
rams->addFG();

there is an overloaded prefix increment operator function and
postfix version in the FootballGame class. what i would like is to
use it with a pointer variable of the class just as you can acess the
other member functions through the pointer and have those functions
execute what is desired. the syntax
rams++; or ++rams; is applicable to an object variable on the stack
memory, but not a pointer variable. i don't have any references, so i
am trying to see how this would be approached. the rams->addFG()adds 3
points to the score being accumulated in this instance of the class.

concerning incrementation with the pointer for the heap object, this
is what i should be doing:

rams->operator ++();//prefix
rams->operator ++(0);//postfix

thanks again,
anthony
 
J

John Harrison

hi john,

hope that all is well. i had to go outside, smile, and take a deep
breath when considering the observation signified. this allowed what
was intended once amended.

I guess its a mistake you'll only make once. The morals are: pay attentions
to warning messages; write code that doesn't generate any warning messages;
set your compiler to generate as many warning messages as reasonable. These
are all good practical steps.
there is an overloaded prefix increment operator function and
postfix version in the FootballGame class. what i would like is to
use it with a pointer variable of the class just as you can acess the
other member functions through the pointer and have those functions
execute what is desired. the syntax
rams++; or ++rams; is applicable to an object variable on the stack
memory, but not a pointer variable.

OK, I missed that. There is no way to overload operators for built in types
(like pointers). However what you can do is very simple

(*rams)++;

or

++(*rams);

and your version of operator++ will be called.
i don't have any references, so i
am trying to see how this would be approached. the rams->addFG()adds 3
points to the score being accumulated in this instance of the class.

concerning incrementation with the pointer for the heap object, this
is what i should be doing:

rams->operator ++();//prefix
rams->operator ++(0);//postfix

That should work as well.

john
 
A

August1

OK, I missed that. There is no way to overload operators for built in types
(like pointers). However what you can do is very simple

(*rams)++;

or

++(*rams);

i like these uses as well and have incorporated them also. the
program goes well beyond what the author requested yet, like most
programs, could have so much more added that it is not amusing. it is
sufficient for demonstration only.

//interface file
#if !defined(FOOTBALLGAME_H)
#define FOOTBALLGAME_H

class FootballGame
{
public:

FootballGame(void); //default constructor declaration
//parameterized constructor declaration
FootballGame(char* szName, char* szCity, char* szQB, char* szMascot);
FootballGame(const FootballGame&); //copy constructor
~FootballGame(void); //destructor declaration
FootballGame& operator = (const FootballGame&);
void operator++(); //prefix unary operator declaration
void operator++(int);//postfix unary operator declaration
void addFG();
void addSafety();
void add2PointConv();
void setTeamName(char* szName);
char* getTeamName() const;
void setCity(char* szCity);
char* getCity() const;
void setQB(char* szQB);
char* getQB() const;
void setMascot(char* szMascot);
char* getMascot() const;
int getTeamTDs() const;
int getTeamFGs() const;
int getTeamSafeties() const;
int getTeamPATs() const;
int getTeam2PTconvs() const;
int getScore() const;
static int getNumTDs();
static int getNumSafeties();
static int getNumPATs();
static int getNum2PtConvs();
static int getNumFGs();

private:
int iScore;
int iTeamTDs;
int iTeamFGs;
int iTeamSafeties;
int iTeamPATs;
int iTeam2PtConvs;
static int iNumTDs;
static int iNumSafeties;
static int iNumFGs;
static int iNumPATs;
static int iNum2PtConvs;
char* szTeamName;
char* szCityName;
char* szQBName;
char* szMascotName;
};//end class FootballGame

#endif

//implementation file
#include "footballgame.h"
#include <cstring>

//initialize static global member variables
int FootballGame::iNumTDs = 0;
int FootballGame::iNum2PtConvs = 0;
int FootballGame::iNumSafeties = 0;
int FootballGame::iNumFGs = 0;
int FootballGame::iNumPATs = 0;

FootballGame::FootballGame(void)
{//default constructor definition
szTeamName = new char[25];
strcpy(szTeamName,"");
szCityName = new char[25];
strcpy(szCityName,"");
szQBName = new char[25];
strcpy(szQBName,"");
szMascotName = new char[25];
strcpy(szMascotName,"");
iScore = 0;
iTeamTDs = 0;
iTeamFGs = 0;
iTeamSafeties = 0;
iTeamPATs = 0;
iTeam2PtConvs = 0;
}

FootballGame::FootballGame(char* szName, char* szCity, char* szQB,
char* szMascot)
{//parameterized constructor definition
szTeamName = new char[25];
strcpy(szTeamName,szName);
szCityName = new char[25];
strcpy(szCityName,szCity);
szQBName = new char[25];
strcpy(szQBName,szQB);
szMascotName = new char[25];
strcpy(szMascotName,szMascot);
iScore = 0;
iTeamTDs = 0;
iTeamFGs = 0;
iTeamSafeties = 0;
iTeamPATs = 0;
iTeam2PtConvs = 0;
}

FootballGame::FootballGame(const FootballGame& sourceTeam)
{//copy constructor definition
szTeamName = new char[25];
strcpy(szTeamName,sourceTeam.szTeamName);
szCityName = new char[25];
strcpy(szCityName,sourceTeam.szCityName);
szQBName = new char[25];
strcpy(szQBName,sourceTeam.szQBName);
szMascotName = new char[25];
strcpy(szMascotName,sourceTeam.szMascotName);
iScore = 0;
iTeamTDs = 0;
iTeamFGs = 0;
iTeamPATs = 0;
iTeamSafeties = 0;
iTeam2PtConvs = 0;
}

FootballGame::~FootballGame(void)
{//destructor definition
delete[] szTeamName;
delete[] szCityName;
delete[] szQBName;
delete[] szMascotName;
}

FootballGame& FootballGame::eek:perator = (const FootballGame& operand)
{//defines overloaded assignment operator
if(this == &operand)
return *this;
else
{
szTeamName = new char[25];
strcpy(szTeamName,operand.szTeamName);
szCityName = new char[25];
strcpy(szCityName,operand.szCityName);
szQBName = new char[25];
strcpy(szQBName,operand.szQBName);
szMascotName = new char[25];
strcpy(szMascotName,operand.szMascotName);
iTeamTDs = 0;
iScore = 0;
iTeamFGs = 0;
iTeamSafeties = 0;
iTeamPATs = 0;
iTeam2PtConvs = 0;
return *this;
}
}

void FootballGame::eek:perator ++()
{//defines prefix overloaded unary increment operator
iScore += 6;
iNumTDs = iNumTDs + 1;
++iTeamTDs;
}

void FootballGame::eek:perator ++(int iScores)
{//defines postfix overloaded unary increment operator
iScore += 7;
iNumTDs = iNumTDs + 1;
++iTeamTDs;
++iTeamPATs;
++iNumPATs;
}

void FootballGame::add2PointConv()
{
iScore += 2;
++iTeam2PtConvs;
++iNum2PtConvs;
}

void FootballGame::addFG()
{
iScore += 3;
++iTeamFGs;
++iNumFGs;
}

void FootballGame::addSafety()
{
iScore += 2;
++iTeamSafeties;
++iNumSafeties;
}

void FootballGame::setCity(char* szCity)
{
strcpy(szCityName,szCity);
}

char* FootballGame::getCity() const
{
return szCityName;
}

void FootballGame::setMascot(char* szMascot)
{
strcpy(szMascotName,szMascot);
}

char* FootballGame::getMascot() const
{
return szMascotName;
}

void FootballGame::setQB(char* szQB)
{
strcpy(szQBName,szQB);
}

char* FootballGame::getQB() const
{
return szQBName;
}

void FootballGame::setTeamName(char* szName)
{
strcpy(szTeamName,szName);
}

char* FootballGame::getTeamName() const
{
return szTeamName;
}

int FootballGame::getScore() const
{
return iScore;
}

int FootballGame::getTeamTDs() const
{//return number of TDs scored by individual team
return iTeamTDs;
}

int FootballGame::getTeamPATs() const
{
return iTeamPATs;
}

int FootballGame::getTeam2PTconvs() const
{
return iTeam2PtConvs;
}

int FootballGame::getTeamSafeties() const
{
return iTeamSafeties;
}

int FootballGame::getTeamFGs() const
{
return iTeamFGs;
}

//Static Member Function Definitions
int FootballGame::getNumTDs()
{/*static function to return num of all TDs for all objects
of class where a team scores a TD*/
return iNumTDs;
}

int FootballGame::getNumFGs()
{
return iNumFGs;
}

int FootballGame::getNum2PtConvs()
{
return iNum2PtConvs;
}

int FootballGame::getNumSafeties()
{
return iNumSafeties;
}

int FootballGame::getNumPATs()
{
return iNumPATs;
}

//user/client source file
#include <iostream>
#include <cstring>
#include "footballgame.h"
using namespace std;

int main(void)
{
char szEnter[1] = "";

//instantiate class object and pass values using parameterized
constructor
FootballGame game("Carolina Panthers", "Charlotte",
"Delhomme", "Sir Purr");

//display values passed
cout << "Team: " << game.getTeamName() << "\t " << "Mascot: "
<< game.getMascot() << "\n"
<< "Quarterback: " << game.getQB() << "\t "
<< "City: " << game.getCity() << endl;

++game; //calls prefix overloaded unary increment operator
cout << "Touchdown : missed PAT: " << game.getScore() << endl;
++game;
game.add2PointConv();
cout << "Touchdown + 2 point conversion: " << game.getScore() << endl;
game++; //calls postfix overloaded unary increment operator
cout << "Touchdown + PAT: " << game.getScore() << endl;
game++;
cout << "Touchdown + PAT: " << game.getScore() << endl;
game.addFG();
cout << "Field goal: " << game.getScore() << endl;
game.addSafety();
cout << "Defensive safety: " << game.getScore() << endl;
cout << "Touchdowns: " << game.getTeamTDs() << endl;
cout << "PATs: " << game.getTeamPATs() << endl;
cout << "2 Point Conversions: " << game.getTeam2PTconvs() << endl;
cout << "Field Goals: " << game.getTeamFGs() << endl;
cout << "Defensive Safeties: " << game.getTeamSafeties()
<< endl << endl;

//user prompt to slow program execution
cout << "Press Enter for next team";
cin.get(szEnter,1,'\n');
if(strcmp(szEnter,"") == 0)
{
cin.clear();
cin.ignore(255,'\n');
}
else
cin.ignore(255,'\n');

cout << endl;//spacing
FootballGame cowboys(game);//create object using copy constructor

//set new string values
cowboys.setTeamName("Dallas Cowboys");cowboys.setQB("Aiken");
cowboys.setCity("Dallas");cowboys.setMascot("Cheerleaders");
cout << "Team: " << cowboys.getTeamName() << "\t "
<< "Mascot: " << cowboys.getMascot() << "\n"
<< "Quarterback: " << cowboys.getQB() << "\t " << "City: "
<< cowboys.getCity() << endl;

cowboys++;
cout << "Touchdown + PAT: " << cowboys.getScore() << endl;
++cowboys;
cout << "Touchdown : missed PAT: " << cowboys.getScore() << endl;
cowboys.addFG();
cout << "Field goal: " << cowboys.getScore() << endl;
cout << "Touchdowns: " << cowboys.getTeamTDs() << endl;
cout << "PATs: " << cowboys.getTeamPATs() << endl;
cout << "2 Point Conversions: " << cowboys.getTeam2PTconvs() << endl;
cout << "Field Goals: " << cowboys.getTeamFGs() << endl;
cout << "Defensive Safeties: " << cowboys.getTeamSafeties()
<< endl << endl;

cout << "Press Enter for next team";
cin.get(szEnter,1);
if(strcmp(szEnter,"") == 0)
{
cin.clear();
cin.ignore(255,'\n');
}
else
cin.ignore(255,'\n');

cout << endl;//spacing
//create class object on the heap using the default destructor
FootballGame* rams = new FootballGame();
rams->setTeamName("L.A. Rams");rams->setQB("Flutie");
rams->setCity("Los Angeles");rams->setMascot("Rambo");
cout << "Team: " << rams->getTeamName() << "\t\t " << "Mascot: "
<< rams->getMascot() << "\n" << "Quarterback: " << rams->getQB()
<< "\t " << "City: " << rams->getCity() << endl;

rams->addFG();
cout << "Field goal: " << rams->getScore() << endl;
//rams->operator ++();//overloaded pre-increment 6 points
++(*rams);//signifies another way to use increment operator
cout << "Touchdown : missed PAT: " << rams->getScore() << endl;
rams->operator ++();//6 points
rams->add2PointConv();// + 2 points
cout << "Touchdown + 2 point conversion: " << rams->getScore()
<< endl;
//rams->operator ++(0);//overloaded postfix(7 points)
(*rams)++;//another way to call increment function
cout << "Touchdown + PAT: " << rams->getScore() << endl;
cout << "Touchdowns: " << rams->getTeamTDs() << endl;
cout << "PATs: " << rams->getTeamPATs() << endl;
cout << "2 Point Conversions: " << rams->getTeam2PTconvs() << endl;
cout << "Field Goals: " << rams->getTeamFGs() << endl;
cout << "Defensive Safeties: " << rams->getTeamSafeties()
<< endl << endl;
cout << "Number of touchdowns for all teams: "
<< FootballGame::getNumTDs()
<< endl;
cout << "Number of PATs for all teams: "
<< FootballGame::getNumPATs() << endl;
cout << "Number of 2 Point Conversions: "
<< FootballGame::getNum2PtConvs()
<< endl;
cout << "Number of field goals for all teams: "
<< FootballGame::getNumFGs()
<< endl;
cout << "Number of safeties for all teams: "
<< FootballGame::getNumSafeties() << endl;

delete rams;//remove contents from free store memory

return EXIT_SUCCESS;
}//end main
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top