Explore BrainMass

Explore BrainMass

    C program to sort the client data on various fields

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write a C program that prompts the user to enter data regarding some clients.

    The user should be prompted for client account number (a UNIQUE positive integer between 1 and 1000), a name (a string, up to 25 in length), and the account balance (a positive floating point number) for each client. The user input terminates once the user enters a -999 as the account number.

    Store this client information in an array of type struct (something). Make the array sizes large enough to hold data for up to 25 clients.

    Once the user has completed entering the data, the program should then SORT THE DATA IN ASCENDING ORDER BY ACCOUNT NUMBER, OR NAME OR BALANCE, and output the client data in table form.

    Please refer to the attached document (P5.docx) for exact details.

    © BrainMass Inc. brainmass.com October 2, 2020, 12:03 am ad1c9bdddf


    Solution Preview

    Attached 306677.c has been tested for warning and error free compilation via "gcc -Wall 306677.c". It has ...

    Solution Summary

    Code does thorough input validation in most places (though it is assumed that user will supply correct input), and makes use of function pointers and qsort function from standard C library, for sorting the data on various structure fields.