Character String

Pages: 12
that's not how it seems to be working. can this operation display both 92.3 and 7.4? doesn't seem so.
Of course it can.

1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
#include <sstream>
#include <iomanip>
using namespace std;

int main()
{
  stringstream ss;
  ss << fixed << setprecision(1) << 92.343 << endl << 7.36;
  cout << ss.str() << endl;
}


Output:
92.3
7.4

so why does the following not work? each time through here, it is not known beforehand if the number is 8.5 or 55.8. so in text out, setting the digits to 3 or to 4 does not cover all cases. so how should i change the following?

ss << std::fixed << std::setprecision(1) << winpercent[z]*100.0;
s=ss.str();
dc.TextOut(x,y,s.c_str(),4);
I already said it before:
The line must be
dc.TextOut(x,y,s.c_str(),s.length());
got it. whew.
thanks all.
Topic archived. No new replies allowed.
Pages: 12