Answer to Question #223053 in Algorithms for hay

Question #223053

Question 2

Using C or C++ or a program of your choice, write a program that list the storage size of a float, list the minimum and maximum float values, and the precision of the float.


Question 3

Describe the steps of how you will compile the program written in Question 2 above in a typical compiler such as gcc or a compiler of your choice. Show the output of how you have compile the program written in Question 2 above and attach all files generated where applicable.


1
Expert's answer
2021-08-04T14:15:18-0400
//program a

#include<iostream>
using namespace std;

int main()
{
    cout << "Size of float : " << sizeof(float)
    << " bytes" <<endl;
    cout << "Size of double : " << sizeof(double)
    << " bytes" << endl;
    cout << "Size of wchar_t : " << sizeof(wchar_t)
    << " bytes" <<endl;
    cout << 9.87654321f << '\n';
    cout << 987.654321f << '\n';
    cout << 987654.321f << '\n';
    cout << 9876543.21f << '\n';
    cout << 0.0000987654321f << '\n';
        return 0;
}

// program b
The the above program as test.cpp
Now, open the command prompt, and compile the cpp file by using the command 
gcc test.cpp -o testfile
and hit enter, then you will be abel to see a new file that will be testfile.exe 
again enter the command testfile and hit enter.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS