Question: Programming in C Print Methods Write the following methods and test them in the main: int printC(int c); // Outputs the character c if it
Programming in C Print Methods
Write the following methods and test them in the main:
int printC(int c); // Outputs the character c if it is printable
int printS(const char *s); // Outputs the string s
int printI(int i); // Outputs the integer i as a base-10 string
int printX(int i); // Outputs the integer i as a hexadecimal string
int printF(double x, int n); // Format: fff.ffff Outputs x as a fixed point string with n digits to the right of the decimal point. Value should be properly rounded. If n < 0, do not print the decimal point (otherwise the same as n = 0).
int printE(double x, int n); // Format: f.fffea (x = f.fff * 10^a) Outputs x in exponential notation with exactly one non-zero digit to the left of the decimal point (unless x = 0) and n digits to the right, a lowercase e, and the exponent. If n < 0, do not print the decimal point (otherwise same as n = 0).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
