Question
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
- 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).
- C++ programming language
textfile1.text:
32 71 95 13 65 47 94 81 86 23 2 1 57 65 16 24 11 54 75 3 97 19 100 66 14 79 86 41 31 53 28 14 40 33 31 89 94 45 14 21 78 12 20 87 60 68 75 64 43 83 38 81 70 35 81 44 14 86 54 96 80 95 69 82 71 45 58 53 63 17 72 25 28 67 30 2 29 75 44 69 33 39 69 29 1 53 77 97 34 34 6 37 78 15 52 92 100 20 76 77
textFile 2.txt:
32 71 95 13 65 47 94 81 86 23 2 1 57 65 16 24 11 54 75 3 97 19 100 66 14 79 86 41 31 53 28 14 40 33 31 89 94 45 14 21 78 12 20 87 60 68 75 64 43 83 38 81 70 35 81 44 14 86 54 96 80 95 69 82 71 45 58 53 63 17 72 25 28 67 30 2 29 75 44 69 33 39 69 29 1 53 77 97 34 34 6 37 78 15 52 92 100 20 76 77
textfile3.txt: 32 71 95 13 65 47 94 81 86 23 2 1 57 65 16 24 11 54 75 3 97 19 100 66 14 79 86 41 31 53 28 14 40 33 31 89 94 45 14 21 78 12 20 87 60 68 75 64 43 83 38 81 70 35 81 44 14 86 54 96 80 95 69 82 71 45 58 53 63 17 72 25 28 67 30 2 29 75 44 69 33 39 69 29 1 53 77 97 34 34 6 37 78 15 52 92 100 20 76 77
Transcribed image text
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