(Solved) : Write C Program Use Dynamic Memory Allocation Reads N Customer Records Text File Customers Q42722577 . . .

Write a C++ program (use dynamic memory allocation) that readsN customer records from a text file(customers.txt) such that the number of therecords is stored on the first line in the file. Each record has 4fields (pieces of information) and stored in the file as shownbelow:

Account Number (integer)

Customer full name (string)

Customer email (string)

Account Balance (double)

The program is expected to print the records in the format shownbelow, sorted in decreasing order based on the account balance:

Account Number : 1201077

Name                    : Jonathan I. Maletic

Email                    : jmaletic@ksu.edu

Balance                 : 10,000.17


Note: The records stored in the followingformat (4 lines for each account):

First Line is the account number

Second Line is full name

Third line is an email

Forth line is the available balance

Important Note: You must use 4 dynamic arrays(one for each field) to store all the records (information) readfrom the file. Then sort the arrays and then print it. The programshould open the files and read the first token and use it size forthe dynamic array.

Example (data saved in the text file)




Jonathan I. Maletic




Saleh M. Alnaeli




Bill Bultman



Account Number : 1333333

Name          : Bill Bultman

Email          :Bill.bultman@uwc.edu

Balance        :120,000.00


Account Number : 1201077

Name          : Jonathan I. Maletic

Email          :jmaletic@ksu.edu

Balance        :10,000.17


Account Number : 1991999

Name          : Saleh M. Alnaeli

Email          :alnaelis@uwstout.edu

Balance        : 5,000.11


Please make sure the code creates a customers.txt file andeverything runs smoothly.

Expert Answer

Answer to Write a C++ program (use dynamic memory allocation) that reads N customer records from a text file (customers.txt) such …

Leave a Comment


We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?