Thanks mats but still no luck, the cout didnt even execute... this is the full code
Code:
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
class Theatre
{
public:
static const int MAX_ROWS = 50;
static const int MAX_COLS = 50;
static const int MAX_FILM = 10;
static const int MAX_CUST = 4;
Theatre();
~Theatre();
int run ( void );
void initalizePlan ( char[][ 50 ] );
std::string getTheatreName() const;
void setCustomerNames ( std::vector<std::string>& );
void getCustomerNames ( std::vector<std::string>& ) const;
void reserveTickets();
private:
char m_TheatrePlan[ MAX_ROWS ][ MAX_COLS ];
std::vector<std::string> m_FilmNames;
std::vector<std::string> m_CustomerNames;
std::string *pm_TheatreName;
};
Theatre::Theatre() : m_FilmNames ( MAX_FILM, "" ),
m_CustomerNames ( MAX_CUST, "" )
{
initalizePlan ( m_TheatrePlan );
pm_TheatreName = new std::string("PICTO-PLEX");
}
Theatre::~Theatre()
{
delete pm_TheatreName;
pm_TheatreName = NULL;
}
int Theatre::run ( void )
{
std::cout << "\t" << getTheatreName() << "\n\n";
int choice = true;
enum
{
PURCHASE_ON_ARRIVAL = 1,
PURCHASE_RESERVED,
RESERVE_TICKETS,
QUIT_SYSTEM
};
do
{
std::cout << " 1 Purchase Tickets On Arrival\n"
<< " 2 Purchase Reserved Tickets\n"
<< " 3 Reserve Tickets\n"
<< " 4 Exit System\n"
<< " > ";
std::cin >> choice;
switch ( choice )
{
PURCHASE_ON_ARRIVAL:
break;
PURCHASE_RESERVED:
break;
RESERVE_TICKETS:
reserveTickets();
break;
QUIT_SYSTEM:
std::cout << "\nExiting....";
return 0;
break;
default:
break;
}
} while ( choice );
}
void Theatre::initalizePlan ( char m_TheatrePlan[][ 50 ] )
{
for ( int i = 0; i < 50; i++ )
{
for ( int j = 0; j < 50; j++ )
m_TheatrePlan[ i ][ j ] = 0 ;
}
}
std::string Theatre::getTheatreName() const
{
return *pm_TheatreName;
}
void Theatre::setCustomerNames ( std::vector<std::string> &rm_CustomerNames )
{
std::string str;
int amount = 0;
std::cout << "\nHow many people are purchasing?: ";
std::cin >> amount;
for ( int i = 1; i <= amount; i++ )
{
std::getline ( std::cin, str );
rm_CustomerNames.push_back ( str );
}
}
void Theatre::getCustomerNames ( std::vector<std::string> &rm_CustomerNames ) const
{
std::vector<std::string>::const_iterator iter;
for ( iter = rm_CustomerNames.begin(); iter != rm_CustomerNames.end(); ++iter )
{
std::cout << *iter << std::endl;
}
}
void Theatre::reserveTickets()
{
setCustomerNames ( m_CustomerNames );
int totalTickets = 0;
for ( int i = 0; i < m_CustomerNames.size(); )
{
std::cout << "\nHow any tickets for " << m_CustomerNames[ i ]
<< ": ";
std::cin >> totalTickets;
while ( totalTickets <= 0 )
{
std::cout << "\nERROR! Cannot hold a negative amount!\n\n"
<< "How many tickets for " << m_CustomerNames[ i ]
<< ": ";
std::cin >> totalTickets;
}
i++;
}
}
// main function - driver //////////////////////////////////////////////////////
//
int main ( void )
{
Theatre theatre;
theatre.run();
return 0; // return value from int main
}