Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Geal: Your assignment is to write a C++ program to read in a list of phone call records from a file, and output them in

image text in transcribed
Geal: Your assignment is to write a C++ program to read in a list of phone call records from a file, and output them in a more user-friendly format to the standard output (cout). In so doing, you will practice using the ifstream class, T'O manipulators, and the string class. File format Here is an example of a file containing three call records: phonelog1.bt - Notepad File Edit Format View Help 20180105110054 +12062812000 5912 20171210091233 +33140205990 364 20171129145316 +85223677065 180 Each line records one phone call As you can see, each line contains 3 different fields: start, E.164, and duration Here is an explanation of these three fields: Start. A 14-digit field giving the year, month, day, hour, minute, and second when the call was started. The format is yyvymmddhhmmss. Military time is used for the hour. For instance. 20180101011020, means the date was January 1, 2018 and the time was 20 seconds past 1:10am. E 104 A 12-character field starting with a + sign followed by 1 l digits. This field specifies the phone number in E.164 format. The first 1-3 digits after the + sign specify the country code of the phone number, and the meaning of the remaining digits is specific to the country or region represented by the country code. To limit the scope of this assignment we will only consider E.164 phone numbers from the following regions 1 33 852 Region North America (US, Canada, and some Caribbean islands) France Hong Kong SAR We've picked these regions because they have simple 12-digit E.164 formats. Duration: This field consists of a variable number of digits, specifying the number of seconds the call lasted In this assignment you can assume that a phone log file contains at least one line. In addition, you may assume that eacline has exactly three fields and is terminated by an end of line. It is possible that some ficlds are not correctly. You should not crash because a field is inconrectly formatted. Main Program Here is an example what it should look like when your main program is run on the file above: Geal: Your assignment is to write a C++ program to read in a list of phone call records from a file, and output them in a more user-friendly format to the standard output (cout). In so doing, you will practice using the ifstream class, T'O manipulators, and the string class. File format Here is an example of a file containing three call records: phonelog1.bt - Notepad File Edit Format View Help 20180105110054 +12062812000 5912 20171210091233 +33140205990 364 20171129145316 +85223677065 180 Each line records one phone call As you can see, each line contains 3 different fields: start, E.164, and duration Here is an explanation of these three fields: Start. A 14-digit field giving the year, month, day, hour, minute, and second when the call was started. The format is yyvymmddhhmmss. Military time is used for the hour. For instance. 20180101011020, means the date was January 1, 2018 and the time was 20 seconds past 1:10am. E 104 A 12-character field starting with a + sign followed by 1 l digits. This field specifies the phone number in E.164 format. The first 1-3 digits after the + sign specify the country code of the phone number, and the meaning of the remaining digits is specific to the country or region represented by the country code. To limit the scope of this assignment we will only consider E.164 phone numbers from the following regions 1 33 852 Region North America (US, Canada, and some Caribbean islands) France Hong Kong SAR We've picked these regions because they have simple 12-digit E.164 formats. Duration: This field consists of a variable number of digits, specifying the number of seconds the call lasted In this assignment you can assume that a phone log file contains at least one line. In addition, you may assume that eacline has exactly three fields and is terminated by an end of line. It is possible that some ficlds are not correctly. You should not crash because a field is inconrectly formatted. Main Program Here is an example what it should look like when your main program is run on the file above

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

Differentiate 3sin(9x+2x)

Answered: 1 week ago

Question

=+ 9. What is inflation and what causes it?

Answered: 1 week ago

Question

=+6. What does the invisible hand of the marketplace do?

Answered: 1 week ago