Kommentare ergänzt

This commit is contained in:
Leaced 2017-04-05 12:26:23 +02:00 committed by GitHub
parent dd1be668ff
commit ff04ee83b4

View file

@ -26,7 +26,7 @@ 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 = 1; idx < amount; idx++) for(unsigned short idx = 1; idx < amount; idx++)
{ {
@ -34,11 +34,10 @@ int main()
int idx2 = idx - 1; int idx2 = idx - 1;
while(idx2>=0 && array[idx2]>temp) array[idx2+1] = array[idx2--]; while(idx2>=0 && array[idx2]>temp) array[idx2+1] = array[idx2--];
array[idx2+1] = temp; array[idx2+1] = temp;
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 sortierten Arrays
} }
getch(); getch();