Kommentare ergänzt

This commit is contained in:
Leaced 2017-04-05 13:12:55 +02:00 committed by GitHub
parent ff04ee83b4
commit eee1a97a8f

View file

@ -26,12 +26,12 @@ int main()
std::cout << "\n"; std::cout << "\n";
for(unsigned short idx =0; idx<amount-1; idx++) std::cout << array[idx] << ", "; for(unsigned short idx =0; idx<amount-1; idx++) std::cout << array[idx] << ", ";
std::cout << array[amount-1] << "\n"; std::cout << array[amount-1] << "\n"; //Ausgabe des unsortierten Arrays
for(unsigned short idx = 0; idx<amount-1; idx++) for(unsigned short idx = 0; idx<amount-1; idx++)
{ {
unsigned short indexMin = idx; unsigned short indexMin = idx;
for(unsigned short idx2 = idx+1; idx2<amount; idx2++) if(array[idx2]<array[indexMin]) indexMin = idx2; for(unsigned short idx2 = idx+1; idx2<amount; idx2++) if(array[idx2]<array[indexMin]) indexMin = idx2;
if(indexMin!=idx) if(indexMin!=idx)
{ {
@ -41,7 +41,7 @@ int main()
} }
for(unsigned short idx =0; idx<amount-1; idx++) std::cout << array[idx] << ", "; for(unsigned short idx =0; idx<amount-1; idx++) std::cout << array[idx] << ", ";
std::cout << array[amount-1] << "\n"; std::cout << array[amount-1] << "\n"; //Ausgabe des Arrays nach jedem Sortierungsschritt
} }
getch(); getch();