C11 standard....
file1.txt:
DAY Blackberry Blueberry Pear Mango apple
Monday 60 35 32 16 30
Tuesday 44 22 34 62 54
Wednesday 33 14 67 13 22
Thursday 24 44 35 15 42
Friday 36 43 24 34 29
file2.txt:
DAY Milk Cheese Butter Cream Yogurt
Monday 50 25 32 16 512
Tuesday 64 12 34 62 97
Wednesday 23 54 67 13 62
Thursday 34 54 25 35 127
Friday 76 23 54 24 120
Here, in the text file, the first line is column title containsless than 100 characters.
Each subsequent line contains six data items separated byspace:
-The day of the week as a string containing no spaces with alength of less than 25 characters.
- Five additional items in each line that are the numbers of eachfood item is sold in as a string with length less than 15characters.
-The number of columns in the file is fixed at 6.
TO DO-
Read the two text files and swap the data in the Apple column offile1.txt with Yogurt column of file2.txt and write the correcteddata in file1-revised.txt and file2-revised.txt.
Assume that Apple and Yogurt is in the last column of file1.txtand file2.txt. Column title should not be modified.
Use feof() function to detect the end of lines.
Number of columns are fixed but number of rows can vary.