Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- int main(int argc, const char * argv[]) {
- double num1, num2, intPart1, intPart2, fractPart1, fractPart2;
- std::cout << "2 Fractional Numbers Integers and Remainders calculator \n";
- std::cout << "Please enter the 1st Fractional Number: \n";
- std::cin >> num1;
- std::cout << "Please enter the 2nd Fractional Number: \n";
- std::cin >> num2;
- fractPart1 = modf(num1, &intPart1);
- fractPart2 = modf(num2, &intPart2);
- std::cout << "Sum of Integer parts is " << intPart1 + intPart2 << std::endl;
- std::cout << "Sum of Fractional parts is " << fractPart1 + fractPart2 << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement