Click here to Skip to main content
15,921,531 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: setWindowLong for more than One window Pin
Richard MacCutchan17-Apr-11 23:00
mveRichard MacCutchan17-Apr-11 23:00 
QuestionHow to get String from ".txt" file and transfer to float Pin
camuoi28817-Apr-11 17:04
camuoi28817-Apr-11 17:04 
AnswerRe: How to get String from ".txt" file and transfer to float Pin
«_Superman_»17-Apr-11 18:50
professional«_Superman_»17-Apr-11 18:50 
GeneralRe: How to get String from ".txt" file and transfer to float Pin
camuoi28817-Apr-11 20:00
camuoi28817-Apr-11 20:00 
GeneralRe: How to get String from ".txt" file and transfer to float Pin
Richard MacCutchan17-Apr-11 22:02
mveRichard MacCutchan17-Apr-11 22:02 
GeneralRe: How to get String from ".txt" file and transfer to float Pin
David Crow18-Apr-11 3:09
David Crow18-Apr-11 3:09 
QuestionPrint with a PDF printer Pin
Gagnon Claude17-Apr-11 7:01
Gagnon Claude17-Apr-11 7:01 
QuestionProxy Type - by code Pin
Ram Shmider16-Apr-11 21:54
Ram Shmider16-Apr-11 21:54 
QuestionCombining if statements Pin
Cyclone_S16-Apr-11 9:16
Cyclone_S16-Apr-11 9:16 
AnswerRe: Combining if statements Pin
Albert Holguin16-Apr-11 17:30
professionalAlbert Holguin16-Apr-11 17:30 
GeneralRe: Combining if statements Pin
Cyclone_S20-Apr-11 9:14
Cyclone_S20-Apr-11 9:14 
QuestionError : 'strcpy_s' : none of the 2 overloads could convert all the argument types. Pin
Le@rner15-Apr-11 19:48
Le@rner15-Apr-11 19:48 
AnswerRe: Error : 'strcpy_s' : none of the 2 overloads could convert all the argument types. Pin
Hans Dietrich15-Apr-11 20:05
mentorHans Dietrich15-Apr-11 20:05 
GeneralRe: Error : 'strcpy_s' : none of the 2 overloads could convert all the argument types. Pin
Le@rner15-Apr-11 20:35
Le@rner15-Apr-11 20:35 
AnswerRe: Error : 'strcpy_s' : none of the 2 overloads could convert all the argument types. Pin
Hans Dietrich15-Apr-11 20:52
mentorHans Dietrich15-Apr-11 20:52 
AnswerRe: Error : 'strcpy_s' : none of the 2 overloads could convert all the argument types. Pin
«_Superman_»15-Apr-11 21:09
professional«_Superman_»15-Apr-11 21:09 
GeneralRe: Error : 'strcpy_s' : none of the 2 overloads could convert all the argument types. Pin
Le@rner15-Apr-11 21:37
Le@rner15-Apr-11 21:37 
GeneralRe: Error : 'strcpy_s' : none of the 2 overloads could convert all the argument types. Pin
«_Superman_»15-Apr-11 21:46
professional«_Superman_»15-Apr-11 21:46 
AnswerRe: Error : 'strcpy_s' : none of the 2 overloads could convert all the argument types. Pin
David Crow16-Apr-11 3:59
David Crow16-Apr-11 3:59 
AnswerRe: Error : 'strcpy_s' : none of the 2 overloads could convert all the argument types. Pin
linc_lee16-Apr-11 4:15
linc_lee16-Apr-11 4:15 
GeneralRe: Error : 'strcpy_s' : none of the 2 overloads could convert all the argument types. Pin
David Crow16-Apr-11 10:32
David Crow16-Apr-11 10:32 
AnswerRe: Error : 'strcpy_s' : none of the 2 overloads could convert all the argument types. Pin
refla17-Apr-11 1:41
refla17-Apr-11 1:41 
QuestionVisual Studio 4.1 Pin
venkat11615-Apr-11 19:15
venkat11615-Apr-11 19:15 
AnswerRe: Visual Studio 4.1 Pin
«_Superman_»15-Apr-11 21:17
professional«_Superman_»15-Apr-11 21:17 
QuestionAlgorithm [modified] Pin
Cyclone_S15-Apr-11 13:40
Cyclone_S15-Apr-11 13:40 
Hi, I am coding an algorithm that searches for a box on the screen. So far I got the snake to find the food which works great except that for example. If the snake is moving right it will sometimes move left and move ontop of it's self. I've spent awhile trying to figure it out on my own with no success. I think it has to do with the two blocks of if statements but I'm not sure. Maybe they need to be combined somehow? This is the last thing I need to figure out and my program is finished. Thanks in advance.

I tried.

if(direction_comp!=1){direction_comp=-1;} else {direction_comp=2;}  // If snake is not moving left then move it right else move it up to avoid it from moving on top of it's self.


direction_comp of 1 = left;
direction_comp of -1 = right;
direction_comp of 2 = up;
direction_comp of -2 = down;


void comp_direction()
			{


				if(segments_comp[head_comp]->panel->Left <= Food->Left)
				{	
					if(segments_comp[head_comp]->panel->Top >= Food->Top){direction_comp =2;}
					else{direction_comp=-1;}
				}
				else if(segments_comp[head_comp]->panel->Left >= Food->Left)
				{	
					if(segments_comp[head_comp]->panel->Top >= Food->Top){direction_comp =2;}
					else{direction_comp=1;}

				}
				if(segments_comp[head_comp]->panel->Top <= Food->Top)
				{
					if(segments_comp[head_comp]->panel->Left <= Food->Left){direction_comp =-1;}
					else{direction_comp=-2;}
					
				}
				else if(segments_comp[head_comp]->panel->Top >= Food->Top)
				{
					if(segments_comp[head_comp]->panel->Left >= Food->Left){direction_comp =1;}
					else{direction_comp=2;}
				}

			}


modified on Friday, April 15, 2011 7:47 PM

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.