π Background Information
This problem is available courtey of Professor Jason James (James, 2017).
π― Problem Statement
Allow a user to enter the names of any number of local businesses. When a user enters a name, sort the current list of business names and display the results. Continue this process until the user exits the program.
β Acceptance Criteria
- The program should print a welcome message when the user executes it.
- The user should be able to enter a business name that contains alphanumeric characters and special characters.
- You are allowed to use methods from the standard library (e.g.
std::sortorstd::vector) - The user should be able to enter βyβ, βYβ, βyesβ, or βYesβ to confirm that they want to enter another business name. Other inputs should exit the program gracefully.
- The program should print a goodbye message when the user exits.
- You do NOT need to write unit tests for this lab.
π Dev Notes
- You do NOT need to write unit tests for this lab. It is possible to test an infinite while loop using some advanced testing strategies. However, we will not cover those techniques in this class.
π₯οΈ Example Output
$ ./busisort.out
Welcome to the Business Sorting Program!
Please enter the name of a business: WalMart
Your business is:
WalMart
Another business? y
Please enter the name of a business: JC Penney
Your businesses are:
JC Penney
WalMart
Another business? Y
Please enter the name of a business: Merlin Muffler
Your businesses are:
JC Penney
Merlin Muffler
WalMart
Another business? yes
Please enter the name of a business: Appleby's
Your businesses are:
Appleby's
JC Penney
Merlin Muffler
WalMart
Another business? Yes
Please enter the name of a business: Zippy's
Your businesses are:
Appleby's
JC Penney
Merlin Muffler
WalMart
Zippy's
Another business? no
Thank you for using the Business Sorting Program!π Thought Provoking Questions
- How did you handle spaces in the business names?
- How did you handle special characters in the business names?
- How did you sort the business names?
πΌ Add-Ons For the Portfolio
(One Credit) C-strings Versus String Class
When completing this lab, you probably used c-strings or the C++ string class to store the business names. Refactor your code to use c-strings if you used the string class and vice versa. The output of the program should be identical to what you had before.
π Useful Links
π Works Cited
James, J. (2017). Itβs Raining Strings! In Jason Jamesβ Homepage. http://craie-programming.org/122/labs/strsort.html