Question: Code in C++ textfile1.txt textfile2.txt textfile3.txt Function returning value/reference Exercise 3 (60 minutes coding): A brief file I/O demonstration program, and an input file for

Code in C++

Code in C++ textfile1.txt textfile2.txt textfile3.txt Function returning value/reference Exercise 3 (60

minutes coding): A brief file I/O demonstration program, and an input file

for it. TODO - answer all questions and write programs: 1.Please check

the file operation example files: FileDemo.cpp and rats.dat O. 2. Please name

textfile1.txt

your answer file as "AnswersToFileDemo.txt." 3. Write a program named "FileOperation Practice.cpp."

4. This program should have a main function. 5. In your program

textfile2.txt

Read a text file that contains integers, print out each integer to

"cout" and stop when you hit the end of file. Use this

textfile3.txt

program to read and display the contents of three different text files

(textfile1.txt, textfile2.txt . textfile3.txt ) that contain the same numbers but use

Function returning value/reference Exercise 3 (60 minutes coding): A brief file I/O demonstration program, and an input file for it. TODO - answer all questions and write programs: 1.Please check the file operation example files: FileDemo.cpp and rats.dat O. 2. Please name your answer file as "AnswersToFileDemo.txt." 3. Write a program named "FileOperation Practice.cpp." 4. This program should have a main function. 5. In your program Read a text file that contains integers, print out each integer to "cout" and stop when you hit the end of file. Use this program to read and display the contents of three different text files (textfile1.txt, textfile2.txt . textfile3.txt ) that contain the same numbers but use Unix/Linux, Windows/DOS, and Mac OS end of line characters. Do you encounter any problems? Does it matter what OS you're developing your code on? See if transferring these files from, say, a Windows machine to a Linux machine alters them by checking their ASCII contents using the Linux od -a command (Examples (Links to an external site.) to use the od command). Take away for Exercise 3: Simple file I/O Appreciation for subtle text file storage differences FileDemo.cpp: Defines the entry point for the console application. EKKER Modified by Yang Peng on 12/31/17 #include #include #include using namespace std; constants flags, etc.. const static int MAX_SIZE = 100 const static bool DEBUG = true; y related data structures for this program struct rational { int num int denom int main(int arge, char* argv[]) Wexplain the new types here / Using the stream concept in C++, how to write a file. Note you // could use an fstream object to accomplish both tasks but W explicit use of ofstream/ifstream makes responsibilities more obvious. ofstream outFile; outFile.open("rats.dat"); // Question: What options can you add when writing to a faile? for (int i=0; i> top >> bottom) && (count

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!