Question
C programming/ C language Write a program that stores the client data (account number, client name, balance) for clients in a file named alphaClients.txt. The
C programming/ C language
Write a program that stores the client data (account number, client name, balance) for clients in a file named alphaClients.txt. The program will get the data for up to one hundred clients from the user, sort the client data in ascending order by client name and write it to the file.
The account number for a client should be first.
The account number is followed by a space that separates it from the client name.
The name is followed by a newline character which separates it from the balance.
The balance is followed by a newline character. This newline character separates this record from the next record.
Create a structure type to store the client data.
The account number should be stored in a member of type unsigned int. The client name should be stored in an array with thirty characters.
The beginning of the interactive portion of this program is captured below:
Enter the first client's account number or 0 to end input: 2000
Enter the account name: HEB
Enter the account balance: 1039.2
Enter the next client's account number or 0 to end input: 2300
Enter the account name: Southwest Airlines
Enter the account balance: 0
Enter the next client's account number or 0 to end input: 4100
Enter the account name: Hilton
Enter the account balance: -41.17
Enter the next client's account number or 0 to end input: 5300
Enter the account name: Nike
Enter the account balance: 20.26
Enter the next client's account number or 0 to end input: 6100
Enter the account name: REI
Enter the account balance: 201.8
etc.
For testing purposes you may use less than 100 client inputs
and the output file must be sorted by alphabetical order
This is how the output to the file should look like :
9412 Advent, Ltd. 245.31 1222 Adventure Travel 72.74 3910 Bank of America -88.83 1035 Bausch & Lomb 3252.65 6900 Capital One 718.72 1072 Chick-fil-A 0.00 1015 Goodacre 1000.84 2000 HEB 1039.20 2407 Hathaway, Inc. 55.41 4100 Hilton -41.17 8652 MKJ -845.65 5300 Nike 20.26 1086 Quik Trip 94.89 6100 REI 201.80 2405 Ranger 0.00 2300 Southwest Airlines 0.00 1096 Starbucks 3016.78 7900 T-Mobile -10.43 1078 Toyota North America -93.79
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started