Click here to Skip to main content
15,902,870 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Preventing an application from shutting down? Pin
Hamid_RT23-Feb-08 1:32
Hamid_RT23-Feb-08 1:32 
GeneralODBC classes or ADO connection Pin
Demian Panello22-Feb-08 0:51
Demian Panello22-Feb-08 0:51 
GeneralRe: ODBC classes or ADO connection Pin
Ali Rafiee22-Feb-08 5:22
Ali Rafiee22-Feb-08 5:22 
GeneralProblem with CBitmapButton Pin
john563222-Feb-08 0:32
john563222-Feb-08 0:32 
GeneralRe: Problem with CBitmapButton Pin
csc22-Feb-08 1:35
csc22-Feb-08 1:35 
AnswerRe: Problem with CBitmapButton Pin
Rajkumar R22-Feb-08 3:31
Rajkumar R22-Feb-08 3:31 
GeneralRe: Problem with CBitmapButton Pin
Hamid_RT23-Feb-08 1:34
Hamid_RT23-Feb-08 1:34 
QuestionSOCCER robot help? Pin
dopeman22-Feb-08 0:23
dopeman22-Feb-08 0:23 
Been studying a program for a few days now made by a friend of mine, unfortunately he is not in town to answer some of my questions and i really need to understand this ASAP. I am not going to post the whole program but i will post what i think will help you in understanding my queries for this program

This is a soccer robot program made for MFC C++, two opposing teams Y for yellow and P for purple comprising of 10 players each.

This was how the players initial position was declared:

P[0].x = 158; P[0].xi = P[0].x;
P[0].y = 100; P[0].yi = P[0].y;


Declaration for soccer balls initial position:

balx = 325;
baly = 225;

Initializes value for close:

for(int l=0;l<11;l++)
{
Y[l].close = false;
P[l].close = false;
}

//computes for the distance between the ball and the players
for(int m=0;m<11;m++)
{
Y[m].dist = sqrt(pow((Y[m].x-balx),2)+ pow((Y[m].y-baly),2));
P[m].dist = sqrt(pow((P[m].x-balx),2)+ pow((P[m].y-baly),2));
}

Finds the shortest distance between the dark blue players and the ball:

(ALSO DONT UNDERSTAND why y[n].dist was compared to y[p].dist, are they not the same value? Can someone explain why the need for true and false?)

Y[0].close=true;
p=0;
for(int n=0;n<10;n++)
{
if(Y[n].dist < Y[p].dist)
{
Y[p].close=false;
p=n;
Y[n].close=true;
}
}


THIS CODE I DO NOT UNDERSTAND: Please explain what the true and false is for for the .close

Close was declared as a bool. I get everything except the need for the true and false with regards to .close Close was supposed to determine which among the players in the team was nearest to the ball.

if(P[s].close!=true)
{
if(P[s].xi
{P[s].x-=1;}
else {P[s].x+=1;}

if(P[s].yi
{P[s].y-=1;}
else {P[s].y+=1;}

}

Thank you very much, any help would be highly appreciated.

This is a repost, my apologies to the mods but i dont know where i posted my previous one. This will not happen again.
AnswerRe: SOCCER robot help? Pin
CPallini22-Feb-08 0:55
mveCPallini22-Feb-08 0:55 
GeneralRe: SOCCER robot help? Pin
dopeman23-Feb-08 2:14
dopeman23-Feb-08 2:14 
GeneralError Pin
Maynka22-Feb-08 0:07
Maynka22-Feb-08 0:07 
QuestionRe: Error Pin
CPallini22-Feb-08 0:15
mveCPallini22-Feb-08 0:15 
GeneralRe: Error Pin
David Crow22-Feb-08 3:09
David Crow22-Feb-08 3:09 
GeneralAnsi libs to unicode applications Pin
neyerMat21-Feb-08 23:44
neyerMat21-Feb-08 23:44 
GeneralRe: Ansi libs to unicode applications Pin
CPallini22-Feb-08 0:00
mveCPallini22-Feb-08 0:00 
GeneralRe: Ansi libs to unicode applications Pin
neyerMat22-Feb-08 1:22
neyerMat22-Feb-08 1:22 
GeneralRe: Ansi libs to unicode applications Pin
Rajkumar R22-Feb-08 3:21
Rajkumar R22-Feb-08 3:21 
QuestionHtmlHelp with HH_DISPLAY_TEXT_POPUP in arabic language Pin
Sad0121-Feb-08 23:10
Sad0121-Feb-08 23:10 
GeneralVisual Studio 2003 installation and restart problem Pin
akira3221-Feb-08 22:59
akira3221-Feb-08 22:59 
AnswerRe: Visual Studio 2003 installation and restart problem Pin
Rajesh R Subramanian21-Feb-08 23:07
professionalRajesh R Subramanian21-Feb-08 23:07 
QuestionHow can i convert YUV4:2:2 Data To RGB ?? Pin
Soumyadipta21-Feb-08 22:34
Soumyadipta21-Feb-08 22:34 
GeneralRe: How can i convert YUV4:2:2 Data To RGB ?? Pin
CPallini21-Feb-08 22:55
mveCPallini21-Feb-08 22:55 
Generaldetermine sigma size of Gaussian mask Pin
gentleguy21-Feb-08 20:22
gentleguy21-Feb-08 20:22 
GeneralRe: determine sigma size of Gaussian mask Pin
CPallini21-Feb-08 21:20
mveCPallini21-Feb-08 21:20 
GeneralRe: determine sigma size of Gaussian mask Pin
gentleguy21-Feb-08 22:51
gentleguy21-Feb-08 22:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.