After compiling a console application and entering wrong data it gives strange output value, like 2.0434e-006, while it was requesting numerals. Here is the code:
#include <iostream>
#include <conio.h>
int main() {
using namespace std;
float l,w,h;
float s;
cout << "\nCalculating surface area of the parallelepiped\n";
cout << "Enter the raw data:\n";
cout << "Length (cm) -> ";
cin >> l;
cout << "Width (cm) -> ";
cin >> w;
cout << "Height (cm) -> ";
cin >> h;
s = (l*w + l*h + w*h)*2;
cout << "Surface area: " << s << " sq. cm\n";
cout << "\n\nPress any key...";
getch();
}
I heared something about IEEE 754 floating-point faults, but even this information doesn't make me sure in my knowledge.