c programming 55
Charge Account Validation
Write a program that lets the user enter a charge account number. The program should
determine if the number is valid by checking for it in the following list:
5658845 4520125 7895122 8777541 8451277 1302850
8080152 4562555 5552012 5050552 7825877 1250255
1005231 6545231 3852085 7576651 7881200 4581002
The list of numbers above should be initialized in a vector, or in an array. Then, the numbers are sorted, using one of the sorting algorithms covered in this section. Once that is done, the program asks for a charge account number to search for and uses a binary search algorithm to search for the number. The program then lets the user know if number was found or not.
Your sorting algorithm must be implemented from scratch, by hand. However, you may use the binary_search algorithm from the C++ STL algorithms header file to do the searching.
A 20-Point Sample Run:
Another 20-Point Sample Run:
Scoring
Although you are responsible for all the sorting algorithms on the last exam, you are free to choose any of the sorting algorithms covered in section XIII. That said, Which algorithm you choose to implement will determine the maximum number of points you may receive for this problem.
- Radix Sort, Merge Sort – 20 points
- Quick Sort – 18 points
- Insertion Sort, Selection Sort – 16 points
Hints:
Submission Instructions:
- Name your source file hw13.cpp
- Attach it to Canvans when done (as usual).