Okay so I am new to c++ and have a quick question. After looking at the code below I don't understand how to print x to 17.00. I know they are sticky flags I keep using them to demonstrate but why does the 2nd or 3rd line of code not produce 17.00 they produce the output below the code. HELP!!!!
Code:
#include <iostream>
#include <iomanip>
int main(void)
{
double x = 17;
std::cout << x << std::endl;
std::cout << std::setprecision(2) << x << std::endl;
std::cout << std::showpoint << std::setprecision(2) << x << std::endl;
std::cout << std::noshowpoint << std::setprecision(2) << x << std::endl;
return 0;
}
Code:
17
17
17.
17
Press any key to continue...