The maximum value for the Microsoft Visual C++ 6.0 compiler is 1.797693e308. I would like to print this. Could someone tell me why im getting an output of -1.#QNAN0e+000?
LDBL_MAX is supposed to retun the value of 1.797693e308.
Im new to C++. I've heard that I shouldnt use system("pause"), but I dont know what command I should use in its place. Ive heard cin.get() is better. Do I need a a preprocessor directive to run cin.get()? When I put it in the place of system("pause"), it gives me an error.
C++? It looks like you are using C from your header files. As a result, you don't have cin to use .get() on. I forget what the recommended procedure is for C...
In any case, you are storing the maximum size of a double into a int. This truncates it. After that, you tell printf to read from the int's memory as if it were a double (as firedraco said), which means printf is reading garbage data.
I did not make LDBL_MAX myself. Apparently it stores the value of the maximum value for the Microsoft Visual C++ 6.0 compiler (1.797693e308). If I make up a variable, give it the value of 1.797693e308 and print the variable I get the desired output. Its no big deal. Its just that my textbook gave this code in an example, and when I tested it out, it didn't really work.
I know you didn't make it up. What I was saying is using pow() to calculate a value then multiplying is probably causing a loss of precision as opposed to just putting in the exact value via hard-coding it.