Hello, I would like to as for a help. The exercise is following:
Create a program for computing the area or perimeter of the rectangle. Write function
named read, that reads from standard input two real numbers and returns them
through the arguments of the function. Then write functions named area
and perimeter, which take dimensions of the rectangle as arguments and returns
area and perimeter of the rectangle, respectively. In the main fuction call read
function to read dimensions of the rectangle. When the user of the program enters
a character, the progra outputs area of the rectangle. When the user enters p character,
the program outputs its perimeter. For area and perimeter computation call respective
function through pointer to function.
Sample input:
3.5 4.75?
a?
Sample output:
16.625?
Now Ive been trying to run it for quite few minues but It seems to not work, can you help me out pls? here is my code:
Create a program for computing the area or perimeter of the rectangle. Write function
named read, that reads from standard input two real numbers and returns them
through the arguments of the function. Then write functions named area
and perimeter, which take dimensions of the rectangle as arguments and returns
area and perimeter of the rectangle, respectively. In the main fuction call read
function to read dimensions of the rectangle. When the user of the program enters
a character, the progra outputs area of the rectangle. When the user enters p character,
the program outputs its perimeter. For area and perimeter computation call respective
function through pointer to function.
Sample input:
3.5 4.75?
a?
Sample output:
16.625?
Now Ive been trying to run it for quite few minues but It seems to not work, can you help me out pls? here is my code: