Click here to Skip to main content
16,016,568 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MSVC STL threadsafe? Pin
Matt Gullett23-May-02 3:52
Matt Gullett23-May-02 3:52 
GeneralLookupAccountName Pin
Mazdak23-May-02 1:54
Mazdak23-May-02 1:54 
GeneralRe: LookupAccountName Pin
Prem Kumar23-May-02 2:02
Prem Kumar23-May-02 2:02 
GeneralRe: LookupAccountName Pin
Mazdak23-May-02 2:34
Mazdak23-May-02 2:34 
GeneralRe: LookupAccountName Pin
Prem Kumar23-May-02 2:55
Prem Kumar23-May-02 2:55 
GeneralDisplay some weird number instead of conten of the ARRAY Pin
tongc23-May-02 1:40
tongc23-May-02 1:40 
GeneralRe: Display some weird number instead of conten of the ARRAY Pin
Nish Nishant23-May-02 1:45
sitebuilderNish Nishant23-May-02 1:45 
GeneralRe: Display some weird number instead of conten of the ARRAY Pin
tongc23-May-02 2:16
tongc23-May-02 2:16 
here is the code for getLadder Smile | :)

void Group::getLadder(int ladder[4][8])	
{
	
	
	Sort();
	//ladder = aILadder;

	for(int i = 0; i < 4; i++)
		for (int j = 0; j < 8; j++)
			ladder[i][j] = aILadder[i][j];
		
	
}


and here is the sort function that is placed within the class but is declared as private.

void Group::Sort()
{
//----Start arrange the ladder------
	const int TEAM = 0;
	const int PLAYED = 1;
	const int WON = 2;
	const int DRAW = 3;
	const int LOST = 4;
	const int FOR = 5;
	const int AGN = 6;
	const int POINTS = 7;

	int row, col;

	//here do the appropriate action to categorize the  game played, game won, draw, 
	//for, against, and point
	//use some sorting algorithm to sort it descending order
	for( row = 0; row < 4; row++)
	{
		for (col = 0; col < 4 ; col++)
		{
			if( row != col)
			{
				aILadder[row][TEAM] = row;
				
				//if team a win team b do the following things
				if(result[row][col] > result[col][row] && result[row][col] != -1)
				{
					aILadder[row][PLAYED] +=1;
					aILadder[row][WON] += 1;
					aILadder[row][FOR] += result[row][col];
					aILadder[row][AGN] += result[col][row];
					aILadder[row][POINTS] += 3;
					
				}
				else //if team a draws team b do the following things
					if(result[row][col] == result[col][row] && result[row][col] != -1)
					{
						aILadder[row][PLAYED]+=1;
						aILadder[row][DRAW]+=1;
						aILadder[row][FOR] += result[row][col];
						aILadder[row][AGN] += result[col][row];
						aILadder[row][POINTS]+=1;
					}
					else//if team a loses team b do the following things
						if(result[row][col] < result[col][row] && result[row][col] != -1)
						{
							aILadder[row][PLAYED]+=1;
							aILadder[row][LOST]+=1;
							aILadder[row][FOR] += result[row][col];
							aILadder[row][AGN] += result[col][row];
						}
			}
		}
	}
	//-----End arranging the ladder

	//====Now start sorting based on the points use Insertion sort :-)
	int tempArr[1][8];
	int j, target;
	
	for(row = 1; row < 4; row++)	//START AT 1
	{
		j = row;
		target = aILadder[row][POINTS];
		
		while(j > 0 && target > aILadder[j-1][POINTS])
		{
			for(int i = 0; i < 8; i++)
			{
				tempArr[0][i] = aILadder[j-1][i];
				aILadder[j-1][i] = aILadder[j][i];
				aILadder[j][i] = tempArr[0][i];
			}
			j--;
		}
		
		
	}

}


Thanks Smile | :)
GeneralRe: Display some weird number instead of conten of the ARRAY Pin
Prem Kumar23-May-02 1:53
Prem Kumar23-May-02 1:53 
GeneralDirectories in CTree View Pin
Sameer Maggon23-May-02 0:53
Sameer Maggon23-May-02 0:53 
GeneralRe: Directories in CTree View Pin
Nish Nishant23-May-02 1:00
sitebuilderNish Nishant23-May-02 1:00 
GeneralRe: Directories in CTree View Pin
Sameer Maggon23-May-02 1:04
Sameer Maggon23-May-02 1:04 
GeneralRe: Directories in CTree View Pin
Nish Nishant23-May-02 1:13
sitebuilderNish Nishant23-May-02 1:13 
GeneralRe: Directories in CTree View Pin
Prem Kumar23-May-02 1:17
Prem Kumar23-May-02 1:17 
GeneralRe: Directories in CTree View Pin
Sameer Maggon23-May-02 1:22
Sameer Maggon23-May-02 1:22 
GeneralRe: Directories in CTree View Pin
Alexandru Savescu23-May-02 1:30
Alexandru Savescu23-May-02 1:30 
GeneralRe: Directories in CTree View Pin
Nish Nishant23-May-02 1:24
sitebuilderNish Nishant23-May-02 1:24 
GeneralRe: Directories in CTree View Pin
Prem Kumar23-May-02 1:39
Prem Kumar23-May-02 1:39 
GeneralRe: Directories in CTree View Pin
Sameer Maggon23-May-02 2:08
Sameer Maggon23-May-02 2:08 
GeneralRe: Directories in CTree View Pin
Sameer Maggon23-May-02 2:09
Sameer Maggon23-May-02 2:09 
GeneralRe: Solved Pin
Sameer Maggon23-May-02 2:03
Sameer Maggon23-May-02 2:03 
GeneralRe: Directories in CTree View Pin
Ravi Bhavnani23-May-02 3:31
professionalRavi Bhavnani23-May-02 3:31 
GeneralActiveX Please Help Pin
Sameer Maggon23-May-02 0:10
Sameer Maggon23-May-02 0:10 
GeneralCEdit box Pin
Ruca22-May-02 23:52
Ruca22-May-02 23:52 
GeneralRe: CEdit box Pin
Nish Nishant23-May-02 0:04
sitebuilderNish Nishant23-May-02 0:04 

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.