
Write a C program that gets a source file name from a user. If the file does not exist, it will generate a proper error and exits.
If the file exists, it also gets the name of two more files from the user, say destination1 and destination2. These files don’t need to exist as they are files that need to be written to.
If the files cannot be opened for writing, a proper error will be generated.
The program then reads the source file line by line. It will copy every line that has a digit in it to destination 2 and lines that have no digit in them to destination 1. Feel free to use ctype’s isdigit() function to identify digit characters.
Example:
If source file is:
Hi My name is Veria
Hello My name is John. How can I help you?
I have a problem with my giga bit internet. The speed should be around 1000 but it’s just 200
Sure! I can help with that.
Can I have your number in case we get disconnected?
Sure! My number’s 647-123-1234
First file (destination 1) should be
Hi My name is Veria
Hello My name is John. How can I help you?
Sure! I can help with that.
Can I have your number in case we get disconnected?
Second file (destination2) should be
I have a problem with my giga bit internet. The speed should be around 1000 but it’s just 200
Sure! My number’s 647-123-1234
The program then displays a report mentioning how many lines were copied into each destination file.

Step by stepSolved in 2 steps with 3 images

- In C++ Could someone Write a program that will read a document/txt file thats written in ASCII and converts it into normal text and then display the text on the screen. I wanna know what some more professional ones look like becaume mine looks pretty jumbledarrow_forwardComputer Science Part C: Interactive Driver Program Write an interactive driver program that creates a Course object (you can decide the name and roster/waitlist sizes). Then, use a loop to interactively allow the user to add students, drop students, or view the course. Display the result (success/failure) of each add/drop.arrow_forwardHelp write a C++ Program to do the following: This is to create a prototype for a Web browser. You’ll do this by transforming the file viewer created (SHOWN BELOW) into a browser for a web of files that are all located on a single computer. (This is in contrast to the real World Wide Web whose pages are located all over the world.) Details The files in this web of files are plain text files that may contain anchors that provide links to other files. More precisely, an anchor is a string of the form 1 where filename is the name of another file and text is a piece of text. For example, here’s a line of text that contains an anchor: More is available. To keep things simple, assume that every anchor is separated from adjacent text by white space and that the strings filename and text cannot contain white space. Your browser should work exactly like the file viewer, except for the following: 1. When an anchor is displayed, it should appear as [n] where n is a number that is unique to…arrow_forward
- Write a C++ program that does the following: Your main function will display a menu with the following options: 1- Calculate average 2- Calculate minimum 3- Calculate maximum 4- Write data to a file 5- Read data from a file 6- exit You will need to implement the above menu using the switch selection structure. You need to validate that the user enters a valid value (an integer between 1 – 6). The logic will keep looping non-stop till the user enter “6” which means the program will exit When the user enters “1” (calculate average), you need to call a function called calcAverage that returns nothing and accept no parameter. When the user enters “2” (calculate minimum), you need to call a function called calcMinimum that returns an integer and accept no parameter. Then the main function will print the value returned from that function When the user enters “3” (calculate maximum), you need to call a function called calcMaximum that returns nothing and accept no parameter. When the user…arrow_forwardYou are burning some music CDs for a party. You have arranged a list of songs in the order youwant to play them. However, you would like to maximize your use of space on the CD, whichholds 80 minutes of music. To do so, you want to figure out the total time for a group of songsand see how well they fit. Write a design and a C++ program to help you accomplish this task.The data are on file “songs.txt” (which is provided for you). The time is entered as seconds. Forexample, if a song takes 7 minutes and 42 seconds to play, the data entered for that song wouldbe 462.After all the data has been read, the application should print a message indicating the timeremaining on the CD. The output must be in the form of a table with columns and headingswritten on a file. For example: (see image) Note: the output converts the input from seconds to minutes and seconds. Use meaningfulvariable names, proper indentation, and appropriate comments. Thoroughly test the programusing your own data sets.Use…arrow_forwardDemonstrate an understanding of basic C++ programming concepts by completing the following: Program: Create a simple C++ console application that will write a program that will take two string inputs from a user. Your program should concatenate the two strings and then print the resulting output to the screen. Take the two string inputs from the user 3 times for varying string lengths. Program Analysis: Given your program implementation, discuss and identify the possible vulnerabilities that may exist. If present, discuss solutions to minimize the vulnerabilities. Then discuss and identify possible problems that can result in errors for string manipulation of data. Your program analysis should be 1-2 pages in length.arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





