1. ## Forloop

Hello, im writtign a program that will process basketball data. The ending file will look like this:

CONFERENCE OVERALL
Rank Team W-L &#37; WINS MARGIN W-L % WINS MARGIN
1 WILM 3-1 0.750 +7.25 7-2 0.778 +10.00
1 OTT 3-1 0.750 +14.00 5-4 0.556 +7.56
1 ONU 3-1 0.750 +15.25 7-2 0.778 +17.78
1 CAP 3-1 0.750 +11.75 7-2 0.778 +13.67
1 BW 3-1 0.750 +10.50 8-1 0.889 +13.56
6 MUC 2-2 0.500 -6.25 4-4 0.500 -0.50
7 MUSK 1-2 0.333 -12.00 5-3 0.625 +2.63
8 HEID 1-3 0.250 -4.00 3-4 0.429 +1.57
9 MAR 0-4 0.000 -29.75 2-7 0.222 -10.89
9 JCU 0-3 0.000 -13.00 2-5 0.286 -3.00

I need a for loop that wil compare the % wins and if the are the same to store the same rank in the array else store the corresponding rank.

2. So, sort the data, and check to see if the current team's win pct is the same as the previous team's win pct (which you must have stored somewhere).

3. Yes, i have stored and stored it in parllel arrays.

4. i used a bubble sort, so the highest would be in cell number 9 and the lowest is in cell 0
when iuse a backward for loop the current count is not the count i need. So the when i get to memory cell 0, i would need a rank of 9 rather than a 1 or a 0. So i think i would need to use two forloops. right?

5. That's a little awkward, since that's the wrong way around (you want the highest winning percentage first). But otherwise, you're done -- check against the previous team, and if their win pct is the same, assign this team the same rank as the old team, otherwise assign this team the rank i+1 (or whatever your loop counter is).

6. ok, so i think i might need to change the sort i used.

7. You could just change the comparison operator you're using '<' vs. '>' in your bubble sort, and it should be sorted in the reverse order of you're sorting it now.

8. Code:
```int pointsTemp, conferenceWinstemp,winsTemp, loseTemp, pointsloseTemp, conferenceLosetemp, conferencePointsTemp, conferencePointsloseTemp;					// temp place to store element during swap
float totalAvarageTemp, avaregeTemp;
string nameTemp;

int swaps;					// swaps made in single pass
int slot = 9;				// start at last slot
do
{
swaps = 0;				// have made no swaps yet in this pass
for (int i = 0; i< slot; i++)		// for all elements above this slot
if (ConferenceAvarege[i] < ConferenceAvarege[i-1])		// if in wrong relative order
{
avaregeTemp = ConferenceAvarege[i];		// swap them
ConferenceAvarege[i] = ConferenceAvarege[i-1];
ConferenceAvarege[i-1] = avaregeTemp;

nameTemp = school.name[i];		// swap them
school.name[i] = school.name[i-1];
school.name[i-1] = nameTemp;

conferenceWinstemp = school.conferenceWins[i];		// swap them
school.conferenceWins[i] = school.conferenceWins[i-1];
school.conferenceWins[i-1] = conferenceWinstemp;

conferenceLosetemp = school.conferenceLose[i];		// swap them
school.conferenceLose[i] = school.conferenceLose[i-1];
school.conferenceLose[i-1] = conferenceLosetemp;

conferencePointsloseTemp = school.conferencePointslost[i];		// swap them
school.conferencePointslost[i] = school.conferencePointslost[i-1];
school.conferencePointslost[i-1] = conferencePointsloseTemp;

conferencePointsTemp = school.conferencePoints[i];		// swap them
school.conferencePoints[i] = school.conferencePoints[i-1];
school.conferencePoints[i-1] = conferencePointsTemp;

winsTemp = school.wins[i];		// swap them
school.wins[i] = school.wins[i-1];
school.wins[i-1] = winsTemp;

loseTemp= school.lose[i];		// swap them
school.lose[i] = school.lose[i-1];
school.lose[i-1] = loseTemp;

pointsTemp = school.points[i];		// swap them
school.points[i] = school.points[i-1];
school.points[i-1] = pointsTemp;

pointsloseTemp = school.pointsLost[i];		// swap them
school.pointsLost[i] = school.pointsLost[i-1];
school.pointsLost[i-1] = pointsloseTemp;

totalAvarageTemp = Totalavarage[i];		// swap them
Totalavarage[i] = Totalavarage[i-1];
Totalavarage[i-1] =totalAvarageTemp;

swaps++;		// note that a swap was made
}
slot--;					// get ready to do next slot up
}while (slot>0&& swaps>0);```

I changed all my comparsion to the oppsite and put minus where plus was. Is that right?

9. no, sorry. I just did it right. Thank you. Can you help me do the for loop to do the rank