Given a double precision floating point number with a decimal point, write a function named prg_question_3 to return the whole number and decimal part of the number as a std::pair object of integers with first part being the whole number part and the second part being the fraction or decimal part. For example given the number 3.14, the "first" part of the pair object must be 3 and the "second" must be 14. Do the following: 1. Follow UMPIRE process to get the algorithm. Write only the algorithm as code comments 2. Implement your function( 3. Test your function for numbers 3.14159 and 2.71828. Please follow the test criteria given in the code template

icon
Related questions
Question
Given a double precision floating point number with a decimal point, write a function
named prg_question 3 to return the whole number and decimal part of the number as
a std::pair object of integers with first part being the whole number part and the
second part being the fraction or decimal part. For example given the number 3.14, the
"first" part of the pair object must be 3 and the "second" must be 14.
Do the following:
1. Follow UMPIRE process to get the algorithm. Write only the algorithm as code
comments
2. Implement your function
3. Test your function for numbers 3.14159 and 2.71828. Please follow the test criteria
given in the code template
Transcribed Image Text:Given a double precision floating point number with a decimal point, write a function named prg_question 3 to return the whole number and decimal part of the number as a std::pair object of integers with first part being the whole number part and the second part being the fraction or decimal part. For example given the number 3.14, the "first" part of the pair object must be 3 and the "second" must be 14. Do the following: 1. Follow UMPIRE process to get the algorithm. Write only the algorithm as code comments 2. Implement your function 3. Test your function for numbers 3.14159 and 2.71828. Please follow the test criteria given in the code template
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer