Question: USING UNIX/LINUX COMMANDS IN TERMINAL. ***************q4.c*************** #include int main() { double d = 10.456712; float f = 11.6789; int i = 13; printf(%f %f %d
USING UNIX/LINUX COMMANDS IN TERMINAL.
***************q4.c***************
#include
int main() { double d = 10.456712; float f = 11.6789; int i = 13; printf("%f %f %d ", d, f, i);
return 0; }

4. Download the source code q4.c and make the following edits to it. For each edit, you should only need to change the line with the printf ) function call on it. To get full marks on this question you will need to show the compilation line with no warnings, the diff (1) between the original file and the edited file, and the output generated when the executable is run. Make as few edits as possible; any extraneous or superfluous edits to the file will result in deductions (a) Copy the file q4.c to q4_float.c. Edit q4_float.c to print out (only) 4 decimal places of the floating-point values. (You do not need to show a log of your editing in lab5.txt.) Do not edit the data type of the variable being printed. Do not change the output format of the int variable. Compile q4_float.c and execute the program. Copy the output produced to lab5.txt. Provide the diff (1) between the q4.c and q4_float.c to show your edit to the file. (b) Copy the file q4.c to q4_int.c. Edit q4_int.c to print out only integer values. (You do not need to show a log of your editing in lab5.txt.) Do not edit the data type of the variable being printed; rather edit the format specification. Compile q4 int.c and execute the program. Copy the output produced to lab5.txt. Provide the diff(1) between q4.c and q4 int.c to show vour edit to the source code. (c) Copy the file q4.c to q4_hex.c. Edit q4_hex.c to print out the int variable in hexadecimal, with a leading "Ox". (You do not need to show a log of your editing in lab5.txt.) Do not edit the data type of the variable being printed. Do not change the output of the other variables Compile q4_hex.c and execute the program. Copy the output produced to lab5.txt. Provide the diff (1) between the q4.c and q4_hex.c to show your edit to the file. (d) Copy the file q4.c to q4_cast.c. Edit q4_cast.c to cast the argument i as a float. Modify the corresponding format in the first argument to printf ) to a format appropriate for a floating point number. (You do not need to show a log of your editing in lab6.txt.) Do not change the type or output format of the other variables. Compile q4_cast.c and execute the program Copy the output produced to lab5.txt. Provide the diff (1) between the q4.c and q4 cast.c to show your edit to the file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
