Question: Given the incomplete program below, write two functions, one called integer and another called decimal. You can use following incomplete program. Your assignment is to
Given the incomplete program below, write two functions, one called integer and another called decimal.
You can use following incomplete program. Your assignment is to supply the necessary missing code:
#include
#include using namespace std;
int integer (.)
{ //REPLACE THE WITH THE REQUIRED PARAMETER (A DOUBLE) //WRITE HERE THE CODE TO EXTRACT THE INTEGER AND RETURN IT }
double decimal (.)
{ //REPLACE THE WITH THE REQUIRED PARAMETER //WRITE HERE THE CODE TO EXTRACT THE DECIMAL PORTION, //MAKE SURE ITS POSITIVE OR CONVERT IT AND RETURN IT }
int main() { double x,y; cout > x >> y;
//WRITE THE CODE TO DISPLAY THE RESULT OF CALLING THE //FUNCTIONS //WITH X //WRITE THE CODE TO DISPLAY THE RESULT OF CALLING THE //FUNCTIONS //WITH Y //USE SETW AND LEFT (SEE LESSON 3 NOTES ON OUTPUT) TO LINE //UP THE //RESULTS AS SHOWN ABOVE
return 0; }
Function main should be the one in charge of displaying the results.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
