Well, I'm no allowed to.
I want to use structs because im sure it's easier, but for this project (didn't mention it's a school project) we are only allowed to use anything we've talked about so far, that excludes structs, classes, objects, maps and a lot more.
I got it though, as I intend to only output/save the data via "i", i just took 2 arrays
1 2 3 4
|
string VereinName[18];
int VereinWerte[18][6];
|
so when i refer to VereinWerte[i][2] i also refer to VereinWerte[i] and thus have my two arrays "attached" to each other.
Do you think, for creating a list and sorting that list by
VereinWerte[i][0] > VereinWerte[i][1] > VereinWerte[i][2]>VereinWerte[i][3]> VereinWerte[i][4]
and having VereinWerte[i][5] as the Ranking,
this is a clean and smooth solution?
might look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
//comparing VereinWerte[i][y] (y < 5);
//highest rated VereinWerte gets VereinWerte[i][5] = 1;
k = 0;
do{
k = k + 1;
for (i = 0; i < 18; ++i){
if (VereinWerte[i][5] == k){
f << setw(2) << VereinWerte[i][5] << ".";
f << setiosflags(ios::left);
f << setw(30) << VereinName[i];
f << resetiosflags(ios::left);
f << setw(3) << VereinWerte[i][0] + VereinWerte[i][1] + VereinWerte[i][2]
<< setw(4) << VereinWerte[i][0]
<< setw(3) << VereinWerte[i][1]
<< setw(3) << VereinWerte[i][2]
<< setw(4) << VereinWerte[i][3] << ":"
<< setw(4) << VereinWerte[i][4]
<< setw(6) << VereinWerte[i][0] * 3 + VereinWerte[i][1]
<< endl;
cout << setw(2) << VereinWerte[i][5] << ".";
cout << setiosflags(ios::left);
cout << setw(30) << VereinName[i];
cout << resetiosflags(ios::left);
cout << setw(3) << VereinWerte[i][0] + VereinWerte[i][1] + VereinWerte[i][2]
<< setw(4) << VereinWerte[i][0]
<< setw(3) << VereinWerte[i][1]
<< setw(3) << VereinWerte[i][2]
<< setw(4) << VereinWerte[i][3] << ":"
<< setw(4) << VereinWerte[i][4]
<< setw(6) << VereinWerte[i][0] * 3 + VereinWerte[i][1]
<< endl;
}
}
} while (k <= 18);
|
don't know if just that function is enough of a snippet to understand what I'm going for here :/