Hay Everyone i'm a new member of this fantastic fourm , and i have some problems with programs i'm really stuck with:'( , so guys i really appreciate any one who can help me with anything, and here is the problem ,
Write a program using a set of functions as follows:
1. Reads a floating number in main() then calls a function is_positive that returns true if the given value if positive. One single value parameter must be passed to the function is_positive. If the number is negative you abort (i.e., exit from) the program.
2. main() calls again another function extract_int_float of type void which extracts and returns the integer and fraction parts of the initial number. The fraction part must have exactly 3 digits.
3. main () will call again another function called duplicate of type void which returns the duplicates of the integer and fractional parts as follows:
The function duplicate calls another function duplicate_int of type int which duplicates the integer part if it is an even number or duplicates the next even number otherwise.
The function duplicate calls another function duplicate_frac of type int which duplicates the fractional part if it is an odd number or duplicates the previous odd number otherwise.
Enter the floating number with exactly 3 digits after the decimal point: 125.676
It is positive number.
After extraction the integer part is: 125
After extraction the fraction part is: 676
Integer part is odd then duplicate next even 126: 252
Fraction part is even then duplicate previous odd 675: 1350