Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Has a main() 2. includes the proper header and namespace declarations 3. Create a c++ program using the following requirements. If you code the
1. Has a main() 2. includes the proper header and namespace declarations 3. Create a c++ program using the following requirements. If you code the program using the EXACT steps I've indicated, you will run into a couple of problems. See if you can solve these problems. We'll cover the solution in class. a. Output a message requesting the user enter an integer value; input and store the value. b. Output a message and the value the user entered. c. Output a message requesting the user enter a line of text. This line of text (for the purpose of THIS experience) should contain spaces. That is, enter a line of text such as"I am taking a programming class". Input the line of text using the getline function. Output the line the user entered. d. Output a message requesting the user enter a string, an integer, a floating point number and a character. e. Output a message and the values the user entered. f. Download the attached file: inputFile.txt. Place it in the SAME directory as your program. Open and look at the file. Create 5 different variables, one for each line in the code. Create a proper datatype for each. g. Open the file using the filename as a string literal (hard coded), i.e., "inputFile.txt", in the open statement. h. Close the file. i. Output a message requesting the user enter the file name. Input the file name and store in a STRING datatype. j. Open the file using the STRING variable defined. k. Read the data in inputFile.txt, storing each line in proper data types created above. For this, you do NOT need to use looping. Read each line in a different input statement using the extraction operator >> . l. Output a message and the values read from the file. m. Close the file. n. Output a message requesting the user enter the file name. Input the file name and store in a character string array, i.e., char fileName[30]. o. Open the file using file name stored in the array variable defined. p. Read the data in inputFile.txt, storing each line in proper data types created above. For this, you do NOT need to use looping. Read each line in a different input statement using the getline function. q. Output a message and the values read from the file. r. Close the file. s. Open a DIFFERENT file for OUTPUT. Hard code the file name in the open statement, i.e., outputFile.txt. If the open is successful, it will be created in the same directory as your program. t. Output (write) to the output file the values read from the input file in step p. u. Close the output file.
** the inputFile.txt says VV **
This file has 5 lines
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