Click here to Skip to main content
16,005,316 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: xvoice.dll Pin
Joeinorange223-Mar-10 10:35
Joeinorange223-Mar-10 10:35 
Generalxvoice.dll Pin
tiem19-Dec-04 15:21
tiem19-Dec-04 15:21 
GeneralManaged DLL Pin
BeerFizz19-Dec-04 15:11
BeerFizz19-Dec-04 15:11 
QuestionType of Derived Class a problem for STL lists? Pin
Jordan C. Atlas19-Dec-04 13:39
Jordan C. Atlas19-Dec-04 13:39 
AnswerRe: Type of Derived Class a problem for STL lists? Pin
demf19-Dec-04 15:04
demf19-Dec-04 15:04 
AnswerRe: Type of Derived Class a problem for STL lists? Pin
19-Dec-04 16:53
suss19-Dec-04 16:53 
GeneralRe: Type of Derived Class a problem for STL lists? Pin
Jordan C. Atlas22-Dec-04 8:34
Jordan C. Atlas22-Dec-04 8:34 
Generalpassing variables Pin
Timothy Grabrian19-Dec-04 12:20
professionalTimothy Grabrian19-Dec-04 12:20 
I 2 global variables:
bool PrintBoard[5][5];
bool MemoryBoard[5][5];

Then I have a function:
void DoMove(int x,int y)
{
	x--;
	y--;

	PrintBoard[x][y] = !PrintBoard[x][y];

	if (y > 0) {//up
		PrintBoard[x][y - 1] = !PrintBoard[x][y - 1];
	}

	if (y < 4) {//dow
		PrintBoard[x][y + 1] = !PrintBoard[x][y + 1];
	}

	if (x > 0) {//left
		PrintBoard[x - 1][y] = !PrintBoard[x - 1][y];
	}

	if (x < 4) {//right
		PrintBoard[x + 1][y] = !PrintBoard[x + 1][y];
	}

	return;
}


As you can see, the DoMove function only changes PrintBoard.
I would like it to be able to change either variable with out much more code (I don't see the point of re-using code here).
I was thinking I could do something like adding another argument to the function that I could pass the global to it, but I couldn't figure out how.

Any Ideas? Thanks
GeneralRe: passing variables Pin
PJ Arends19-Dec-04 15:33
professionalPJ Arends19-Dec-04 15:33 
GeneralRe: passing variables Pin
Timothy Grabrian19-Dec-04 15:59
professionalTimothy Grabrian19-Dec-04 15:59 
GeneralTracking Registered Window Message Pin
rajas19-Dec-04 10:24
rajas19-Dec-04 10:24 
GeneralCapturing Datalink frames Pin
Arvind_Nagarajan_198119-Dec-04 6:08
Arvind_Nagarajan_198119-Dec-04 6:08 
GeneralWant the following riddle source code please help! Pin
babur khan18-Dec-04 21:57
babur khan18-Dec-04 21:57 
GeneralRe: Want the following riddle source code please help! Pin
Alex Korchemniy18-Dec-04 23:07
Alex Korchemniy18-Dec-04 23:07 
GeneralRe: Want the following riddle source code please help! Pin
Anonymous18-Dec-04 23:18
Anonymous18-Dec-04 23:18 
GeneralDelaying Milliseconds in c++ Pin
CNewbie18-Dec-04 16:50
CNewbie18-Dec-04 16:50 
GeneralRe: Delaying Milliseconds in c++ Pin
ThatsAlok18-Dec-04 19:35
ThatsAlok18-Dec-04 19:35 
GeneralRe: Delaying Milliseconds in c++ Pin
CNewbie19-Dec-04 4:33
CNewbie19-Dec-04 4:33 
GeneralRe: Delaying Milliseconds in c++ Pin
Trollslayer19-Dec-04 7:25
mentorTrollslayer19-Dec-04 7:25 
GeneralRe: Delaying Milliseconds in c++ Pin
Malcolm Smart19-Dec-04 11:46
Malcolm Smart19-Dec-04 11:46 
Generaltopmost Pin
Max Santos18-Dec-04 16:39
Max Santos18-Dec-04 16:39 
GeneralRe: topmost Pin
ThatsAlok18-Dec-04 19:46
ThatsAlok18-Dec-04 19:46 
Generalkeyboard error handling Pin
xelitex18-Dec-04 16:00
xelitex18-Dec-04 16:00 
GeneralRe: keyboard error handling Pin
ThatsAlok18-Dec-04 16:11
ThatsAlok18-Dec-04 16:11 
Generalget a window handle from just a process Pin
Spiritofamerica18-Dec-04 13:36
Spiritofamerica18-Dec-04 13:36 

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.