1. (20 points) Write a main function that performs the following operations: a.)
ID: 1810323 • Letter: 1
Question
1. (20 points) Write a main function that performs the following
operations:
a.) Prompts the user to input the names of 3 files: two input files and
an output file.
b.) Reads in the two input files line by line and compares the two
lines.
c.) For each line in the inputs, the output should have the line number,
a colon (':'), and either "OK" if the lines match or "DIFF" if the lines
are different.
The input files may be of different lengths.
Note that:
- You will NEED to use the facilities presented in Chapter 10
(specifically, getline(...)) to complete this assignment. If you use the
>> operator, it will ignore whitespace (so your program will likely
report "a a" and "aa" as being the same.
- Your program should be case-sensitive, so you do NOT need to worry
about converting text to lowercase or uppercase.
For example:
input1:
abc
def
g h i
input2:
abc
DEf
ghi
uub
output:
1:OK
2:DIFF
3:DIFF
4:DIFF
Explanation / Answer
#include "std_lib_facilities_3.h" int main() { string file1; string file2; string out_file; { coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.