I am trying to print a decimal no. in following format : "#####+3.01" Case: There is a decimal no (let say 3.01 in this case). I have to print it with its sign +/- preceding with y no. of #, with some fix total width. (let say x = 10 in this case).
I tried do something like this :
double no = 3.01; cout << setfill('#') << setw(10) ; cout << setiosflags(ios::showpos); cout << fixed << setprecision(2) << no << endl;
But i am getting followinfg output :
+#####3.01
Expected Output :
#####+3.01