Question
This assignment uses functions, files, and strings. Enough flexibility is provided for you to apply your knowledge of basic C++ programing to develop your solution.
This assignment uses functions, files, and strings. Enough flexibility is provided for you to apply your knowledge of basic C++ programing to develop your solution.
Develop a functional flowchart and then write a C++ program to solve the following problem.
1. Create a text file named file1.txt and write your brand of computer (like Dell, Aplle, etc) in th e file. You will be reading the name of the file from the keyboard as a string, using the string class. Your program will also read the brand of your computer from the keyb oard. The process of the file creation (name of the file, mode for opening the file, and test ing the open success is done in a user- defined function. The function communicates the status of file open to the calling function).
2. Create a text file named file2.txt and write your computer model in the file. You will be readin g the name of the file from the keyboard as a string, using the s tring class. Your program will also read the model of your computer from the keyboard. The process of the file creation (name of the file, mode for opening the file and testing the open success is done in a user-defined function. The function communicates the status of file open to the calling fu nction)
3. Create a text file named myComputer.txt and write the brand of your computer from the file file1.txt , and the model from file file2.txt . You will be reading the name of the file from the keyboard a s a string, using the string class. The process of the file creatio n (name of the file, mode for opening the file and testing the open success is done in a user-defined function. The function communicates the status of file open to the calling function)
4. At this time, each file will have one line of text in it.
5. Prepare the files for reading.
6. Display the results of the three files in the order shown below :
File1.txt your brand of com puter as written in the file1
File2.txt your model of the c omputer as written in the file2
myComputer.txt your computer brand and the model as written in myComputer
Note that there is a single space between the computer brand an d the computer model when you display the contents of the file myComputer.txt.
You will use a user-defined func tion to display all the files a t once or one at a time.
7. Close all files. You will use a user-defined function that clos es each file separately or all at once.
8. Run the program again and use your choice of the filenames, and different names, different than what you used above and repeat the process.
1. Make sure your media is VIRUS FREE ! (grade of 0 will be g iven for infected media).
2. Comment your program. Good commenting is always required.
3. Use meaningful prompts.
4. Provide a brief description of the problem being solved.
5. Be sure to include a header file at the beginning of your pr ogram as shown in the course syllabus.
6. NO global declarations of VARIABLES allowed in any program that you develop in this course.
7. Illegal inputs must be handled properly without terminating the program.
8 . Full function prototyping and function definitions are requir ed.
9 . At the due date, submit your H8 containing the components of the program specified in the guidelines. You need to include flowchart, the list of your .cpp file, and the sample run of the program in the Word document. The source files for H8.cpp and all related files (.cpp and h files) and the Visio file H8.vsdx will be uploaded as well. Unrelated files should not be present when you upload them to the Blackboard. Homework must be uploaded to the Blackboard by 9 PM of the due date and late homework will not be accepted .
10. Use Microsoft Visual St udio Enterprise 2015 compiler using default compiler settings.
11. Use Microsoft Visio 2013 to develop your flowchart.
12 . Adherence to the ANSI C++ required.
13 . Do not use and in this assignment and all other assignments.
14 . Do not use any #define in your program until the time that is required for class decl aration header files.
15 . No goto statements allowed in any program that you develop in this course.
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