Learn Finance C++, Lesson 24, Bubble sort of struct using pointers

preview_player
Показать описание
This time we build up an array made up of self-made structures. We then sort that array based upon one part of the structure, via a simple bubble sort algorithm making use of pointer arithmetic.

Finished code block:

Рекомендации по теме
Комментарии
Автор

Thank you for this, it greatly helped me in my little game's highscore menu :)

floriandorogi
Автор

PNAS 😂😂
Anyway, this was actually helpful. Thanks!

vee
Автор

i have an assignment and in it i need to sort individual student ranking by percentage so what should i do?

AKHILPOKLE
Автор

Actually, you can reduce the size of unsorted array by 1 after each iteration.
int sizeOfUnsortedArray = sizeOfArray;
for(int i = 0; i < sizeOfUnsortedArray - 1; i++){
if(...){
...
}

sizeOfUnsortedArray--;
}

tonymok