School Project Help URGENT I attend Qantm College

Hey guys and girls i am having trouble making battle ships in a win32 project here is the code i got and the classes are in a header folder. All that happens is it runs then i type my name in then it exits. WHY!!

[code]

#include <iostream>
#include "stdafx.h"
#include "Class.h"
#include "Enemy_Class.h"
using namespace std;

unsigned int City = 0;

void centreText(int y, string Text)
{
setPos(50 - Text.size()/2, y); //centering the text
cout << Text << endl;
}

Map :: Map ()
{
m_mapWidth = new int;
m_mapHeight = new int;
}

Map::~Map ()
{
delete m_mapWidth;
delete m_mapHeight;
}
;
void Map :: GetMap()
{

cout << " ";
for(int a = 0; a < *m_mapHeight; a++)
{
cout << " " << a +1;
}
cout << endl;
for(int b = 0; b < *m_mapWidth; b++)
{
if (b<10)
cout << " ";
cout << b+1;
for(int a = 0; a <*m_mapHeight; a++)
{
cout << " ";
switch(M_map[b][a])
{
case 0:
cout << ".";
break;
case -1:
cout << "0";
break;
case -2:
cout << "#";
break;
default:
cout << "C";
}
}
cout << endl;
}
}

//Set Width A
void Map :: SetWidth()
{
int A;
setColour(RED,BLACK);
cout << "Pick a random number between 1 and 10 for your width: ";

while (true)
{
setColour(WHITE,BLACK);
cin >> *m_mapWidth;
A = *m_mapWidth;
if ( A > 11 || A < 1)
{
setColour(RED,BLACK);
cout << "The Width of the map you have selected is to long or short, Please try again: " << endl;
continue;
}
break;
}
setColour(RED,BLACK);
cout << "The Width of the map you have selected is: ";
setColour(WHITE,BLACK);
cout << A << endl << endl;
}
void Map :: SetLength()
{
int B;
cout << "Pick a random number between 1 and 16 for your Height: ";

while (true)
{
cin >> *m_mapHeight;
B = *m_mapHeight;
if (B > 16 || B <= 1)
{
cout << "The Height of the map you have selected is to long, Please try again: " << endl;
continue;
}
break;
}
cout << "The Height of the map you have selected is: ";
cout << B << endl << endl;
}

int _tmain(int argc, _TCHAR* argv[])
{
int PlayerGrid [15][9];
initConsole();
//Welome to the Thermonuclear War Game
string PlayerName = PlayerName;
setColour(RED,BLACK);
centreText(1,"Welome to the Thermonuclear War");
cout << endl;
setColour(RED,BLACK);
cout << "The purpose of the game is to beat the computer and destroy its cites before it destroys yours" << endl << "Enter your name: ";
setColour(WHITE,BLACK);
cin >> PlayerName;
int b, a;
setColour(RED,BLACK);
cout << endl << "Please enter the amount of cities you which to control between 1 and 10: ";
{
while (City > 11)
{
if (City > 11)
cin >> City;
{
cout << "The Height of the map you have selected is to long, Please try again: " << endl;
continue;
{
break;
}

cout << "You have enter: ";
setColour(WHITE,BLACK);
cout << City << endl;
}
}
}
}
Topic archived. No new replies allowed.