A complete C++ program with the output
Develop a C++ application to implement floating point additionalgorithm by assuming positive numbers only, use the followingpattern to start the code.
• Sign: 0 • Exponent: 10000010 • Fraction:1.1101100000000000000000
#include <iostream> #include <string> int main() { // first input: 3.25 int A_sign = 0; int A exponent 128; std::string A_fraction std::cout << "1st input: " "1 << A_sign << "1 = sign: exponent: << A_exponent << 11 fraction " << A fraction << std::endl; // second input: 11.5 int B_sign 0; int B_exponent = 130; std::string B_fraction = = "1.10100000000000000000000"; = "1.01110000000000000000000";
} std::cout << "2nd input:" "1 << B_sign << sign: exponent: << B_exponent << fraction " << B fraction << std::endl; // implement addition algorithm here // Print sign, exponent, and fraction of final result return 0;
A complete C++ program with the output Develop a C++ application to implement floating point addition algorithm by assum
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am