Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write the program in C language. PART A: Write a C program that reads double numbers from a text file named matrix.txt into a two-dim
write the program in C language.
PART A: Write a C program that reads double numbers from a text file named matrix.txt into a two-dim array with the size 7x4 and displays the contents of the array. matrix.txt Example Run: 19.8 34.6 7.6 11.2 The contents of the array is: 45.7 24.1 43.1 5.6 19.8 34.6 7.6 11.2 6.8 9.0 22.3 1.2 45.7 24.1 43.1 5.6 22.4 84.5 76.2 12.1 6.8 9.0 22.3 1.2 77.6 54.3 43.7 98.0 22.4 84.5 76.2 12.1 45.7 76.3 45.3 5.1 77.6 54.3 43.7 98.0 1.5 8.9 12.6 13.7 45.7 76.3 45.3 5.1 1.5 8.9 12.6 13.7 PART B: After you finish Part A, ask the user to enter two row indexes to swap and validate the input (must be between 0 and 7). Then, swap these rows of the array. (Hint: Use a one-dim temprorary array to do the swap operation.) Example Run: The contents of the array is: 19.8 34.6 7. 11.2 45.7 24.1 43.1 5.6 6.8 9.0 22.3 1.2 22.4 84.5 76.2 12.2 77.6 54.3 43.7 98.0 45.7 76.3 45.3 5.2 1.5 8.9 12.6 13.7 Enter two row indexes to swap: 19 Enter two row indexes to swap: -1 4 Enter two row indexes to swap: 0 2 The contents of the array AFTER the swap operation: 6.8 9.0 22.3 1.2 45.7 24.1 43.1 5.6 19.8 34.6 7.6 11.2 22.4 84.5 76.2 12.1 77.6 54.3 43.7 98.0 45.7 76.3 45.3 5.1 1.5 8.9 12.6 13.7Step 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