Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void sortInventory(Inventory* inventory){
- Inventory temp;
- //Copy the inventory to "temp"
- for(int i = 0; i < 10; i++){
- temp.items[i] = inventory->items[i];
- temp.quantity[i] = inventory->quantity[i];
- }
- //Finally, sort based on item IDs
- for(int i = 0; i < 10; i++){
- for(int j = 0; j < 256; j++){
- if(temp.items[i] == j){
- inventory->items[i] = temp.items[i];
- inventory->quantity[i] = temp.quantity[i];
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement