Kelsey J.
asked 11/09/22C++ Array of Bank accounts & Ask user to sort by name, id or balance.
C++ question: I have a BankAccount class that has private member variables, string name, string id, and int balance. I made an array of 5 Bank Account objects that stored different names, bank balances, and id numbers, and I am required to allow a user to select whether they want to sort a bank account by name, id, or balance. I NEED to make a function using bubble sort code to sort through the array but I am not allowed to create a sort function for each member variable, what I mean by that is...if the user selects to sort by name or sort by balance, I can't call a sortbyname function or a sortbybalance function, I would call the same sort function for all, but I don't know how to do this.
1 Expert Answer
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.