Please restate your problem, as presented it doesn't make much sense to me. What are you trying to achieve, and why can't you use the setprecision(), setw(), and the other functions available from iomanip?

For example:

Quote

However, I am given the following only and requested to produce the above outcome. (not to use the full std function)

Why? But it's possible to use the using std::scientific; clause but the proper way would be to use the scope resolution operator:: as shown.

Jim

I know what you mean by that. But that is the question's requirement. Anyhow, I think I am just going to do the std::scientific way...because I can't find any other way to convert double to scientific or fixed...

Without being able to use the manipulators trying to get your program to produce the desired output will be very difficult. You will probably need to convert the numbers to strings in order to manually format the numbers. And trying to figure out how to format a number in scientific notation is probably above your pay grade. I suggest you ask your instructor if using the iomanipulators is acceptable. I really think your instructor is trying to show you how to properly use the different namespace scoping methods but you need to ask.

Without being able to use the manipulators trying to get your program to produce the desired output will be very difficult. You will probably need to convert the numbers to strings in order to manually format the numbers. And trying to figure out how to format a number in scientific notation is probably above your pay grade. I suggest you ask your instructor if using the iomanipulators is acceptable. I really think your instructor is trying to show you how to properly use the different namespace scoping methods but you need to ask.

Jim

Totally agree(way above my knowledge). Or I can also do the operator overloading (<<) and hard code the output so that when I call "cout<< something" then the output will display the x or y in scientific/fixed format.