hello, acually your site is helping me alots , thanx alots
I have an assignemt n i stuck on readind data from user and hendle them as single string
plzzzzz anyone can help me:( i tried alots and alots
Write a C++ program that will make use of the following two structures
1. The first structure is the Call structure, which represents the data for one phone call. It contains the following data items:
o Country to which the call is made
o Phone number to which call is made (e.g. 4412345467)
o Cost of call (e.g. 3.00)
2. The second structure is the Customer structure which contains the following data items:
o Customer name (e.g. Mohamed Elhadi) (assume only first and last name)
o Phone number (eg. 7234567)
o Number of calls (e.g. 10)
o Pointer to a dynamic array of Call structures whose size is the number of calls.
The program is to do the following:
1. Receive three strings as input where each string contains one data for one customer in the following format:
“customer-name his-number number-of-calls country-called number cost country-called number cost country-called number cost”.
Example (See more data at bottom): “Mohamed Elhadi 7234567 3 UK 4412345467 3.00 Canada 551234567 5.00 UAE 661234567 7.00”
2. For each customer
a. Print a bill as shown in the sample output.
b. Note that the calls of each customer are printed in descending order of cost
c. At the end of the bill, you print total cost of the calls for each customer.
3. Calculate and print the total revenues from all the customers.
4. Your program is to ask the user for total number of customers to be handled first.
5. Use Dynamic allocation /de-allocation of memory.
Your program should have the following functions at minimum:
1. A function to read the data from the user into a customer structure. The customer data should be handled as one single string.
2. Function to calculate the total cost for the customer.
3. A function to print the customer’s data
4. A function to sort customers calls by cost
You may add other functions to the above structures as you see fit.
To make it easy for your testing you can hard-code the input strings (only for testing)
Sample Input Data:
Customer 1: “Mohamed Elhadi 7234567 3 UK 4412345467 3.00 Canada 551234567 5.00 UAE 661234567 7.00”
Customer 2 (make sure that you use your name for this record): “Your name 6234566 1 Egypt 7712345467 8.00”
Customer 3: “John Doe 8234568 2 Libya 8812345467 13.00 USA 11123456 15.00”