i need some support with my program

I am a student and our prefessor has given us an assignment to creat a game in C++, the game is about a player tha moves in a space trying to reach homeland. i have created the 2 dimenson space. i have put the homeland and the palyer. the player moves by inputing number from 1 t 9. my problem is how to delete a blackhole if the players reaches one and the other probelem is that whan i debug it it doesn't execute, this is my program., and how to calculate the curent position of the player and homeland everu time the player makes a step and this can be done by c2 = a2 + b2.
// Detyra.cpp : Defines the entry point for the console application.
#include "StdAfx.h"
#include <iostream> // Imput/Output
#include <cstdlib> // Using rand numbers
#include <time.h> // using curent computer time to randomize numbers
using namespace std; //


int main ()

{


#define YDIM = 20;
#define XDIM = 30;


int Universe[20][30];

int i;
int j;

for ( i = 0; i < 30; i++) //

{
for (j = 0; j < 20; j++)

Universe[j][i] = 0;
}

const int YLOW = 0;
const int YHIGH = 20;
const int XLOW = 0;
const int XHIGH = 30;

int xh; // declare variable x for the homeplanet.
int yh; // declare variable y for the homeplanet.


{

time_t seconds; // using functions srand and rand to choose a randome place for the planet.
time(&seconds);
srand((unsigned int)seconds);

xh = rand()%( XHIGH - XLOW ) + XLOW;
yh = rand()%( YHIGH - YLOW ) + YLOW;

Universe[yh][xh] = 1; //set the position of the array to 1.


}


int xp; //declare variable x for the player.
int yp; //declare variable y for the player.
int a = (xp,yp); // represents the position of the player

/* Use the floop to choose a random position inside the universe for
the palyer different from that to planet */

do{

xp = rand()%(XHIGH - XLOW ) + XLOW;
yp = rand()%(YHIGH - YLOW ) + YLOW;

}while ( yp != yh && xp != xh);



int xb = 0; //declare variable x for the blackhole.
int yb = 0; //declare variable y for the blackhole.
int total = 0; // declare variable total end initialize to count the total steps.


/* Using the loop to place randomly 60 balckholes
and make sure that no one of them not to corespondent in the same place
with the planet or the player */

while ( total < 60 )

{

do
{



xb = rand()%(XHIGH - XLOW) + XLOW;
yb = rand()%(YHIGH - YLOW) + YLOW;



}while ((yb!= 1 && xb != 1) || ( yb != a && xb != a));

Universe[yb][xb] = 2;
}

int step;
int counter = 0;

cout << " Enter a number from 1 to 9";
cin >> step;

if (1<= step && step <= 9)
cout << "Enter a valid number" << endl;

while ( Universe[yp][xp] != Universe[yh][xh])

{

if (1 == step)

{
xp--;
yp++;
}

if (2 == step)

yp++;

if (3 == step)

{
xp++;
yp++;
}

if ( 4 == step)

xp--;

if (5 == step)

{
xp = xp;
yp = yp;

}
if (6 == step)

xp++;

if (7 == step)

{
xp--;
yp--;
}

if (8 == step)

yp--;

if (9 == step )

{
xp++;
yp--;

}

if ((xp > XHIGH || xp < XLOW) && (yp > YHIGH || yp < YLOW))

{

cout << " You are now out of space\n" << endl;
}

if (Universe[yp][xp]== 2)

{
cout << " This is a blackhole" << endl;

if (1 == step)

{
xp++;
yp--;
}

if (2 == step)

yp--;

if (3 == step)

{
xp--;
yp--;
}

if ( 4 == step)

xp++;

if (5 == step)
{
xp = xp;
yp = yp;
}
if (6 == step)

xp--;

if (7 == step)

{
xp++;
yp++;
}

if (8 == step)

yp++;

if (9 == step )

{
xp--;
yp++;

}
}

if (Universe[yp][xp] == Universe[yh][xh])

{
cout << " Congratulation you reached homeland:" << endl;
cout << "\nYour total steps are:" << total << endl;

counter += step;
total += counter;
}

cout << " Your new location is:" << (yp,xp) << endl;
cout << " Enter a number from 1 to 9:" << endl;
}

}






I'm not sure I follow your questions about deleting a black hole; but wouldn't it be just set that location to 0 instead of 2?

As far as the program not executing, I'll need more information: Do you see any errors, for example?
the assignment asks me to place 60 black holes rundomly chosed in the universe and each of the black holes should be represented as a "2" so i have set them as o from the beginning. if the player falls in a black hole the player must be returned to his previous position and the black hole should be eliminated form the game.

as for the executing a warning C4700 comes out

When you say eliminated from the game, do you mean it becomes free space into which the player may now pass freely? If so, set the value at the black hole to 0.
yes that is the player may pass freely. thanks
what does error MSB6003 means?
I have no idea: Try this site: http://msdn.microsoft.com/en-us/library/ms681381(v=VS.85).aspx

Or try Google!
Topic archived. No new replies allowed.