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.
//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.
Comments
Leave a comment