Question
I already made a .bmp file exactly like the one in figure 4, but I can't do the C program. 2. Write a C program
I already made a .bmp file exactly like the one in figure 4, but I can't do the C program.
2. Write a C program to implement the following functions.
2.1. Include required libraries and define required variables and define a 2D array to store the data loaded from the file; [5 points]
2.2. Write a function loadFile(myBmp) to read a .bmp file and store them into an 2D array of integers; [10 points]
2.3. Write a function printMenu to print a menu for users to choose one of the following functions and call the function; The program must include a q option to exit the program. [10 points]
2.4. Write a function printArray to print the hexadecimal numbers stored in the 2D array. You can use %x control character in printf; [10 points]
2.5. Write a function flipHorizonal to flip the image horizontally and save the data into a new file called myBMPFlipped1.bmp; [10 points]
2.6. Write a function flipVertical to flip the image vertically and save the data into a new file called myBMPFlipped2.bmp. [10 points]
2.7. Write a function saveToFile to save the array data (modified through flip operation) into another file. This function should be called by flipHorizonal and flipVertical. [10 points]
2.8. Write a function doAll, which performs the following tasks: [10 points]
i. loadFile(myBmp)
ii. printArray;
iii. flipHorizonal;
iv. loadFile(myBMPFlipped1.bmp)
v. printArray;
vi. flipVertical;
vii. loadFile(myBMPFlipped2.bmp)
viii. printArray;
2.9. Write the main function to perform at least the following tasks: [5 points]
i. Call loadFile to load the .bmp file data into the 2D array;
ii. Call printMenu;
iii. Return the menu after performing one function, and quit the program is q is entered.
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