qt4 - QTextStream used for console output -


hey, i'm facing annoying problem qtextstream used console output.

qtextstream cout(stdout, qiodevice::writeonly); cout.setrealnumberprecision(1); cout.setpadchar('.');  //  code generating values of f[i] [...]  (int = 10; >= 0; i--) {     if (f[i] < -0.04 || f[i] > 0.04 || 1)     {        cout.setrealnumbernotation(qtextstream::fixednotation);        cout.setfieldalignment(qtextstream::alignright);        cout.setfieldwidth(8);        cout << f[i];        cout.setfieldalignment(qtextstream::alignleft);        cout.setfieldwidth(3);        cout << "*x^";        cout.setfieldalignment(qtextstream::alignleft);        cout.setnumberflags(cout.numberflags() & ~qtextstream::forcesign);        cout << << endl;     } } 

the results with: found polynomial is:

.....0.0*x^10. ......-0.0*x^9.. .......0.0*x^8.. ......-0.0*x^7.. .......0.0*x^6.. .......1.0*x^5.. .....-36.0*x^4.. .....397.0*x^3.. ...-1674.0*x^2.. ....2753.0*x^1.. ...-1440.0*x^0.. .. 

i cannot rid of strange shift in first line, , don't know .. come from. think there might problem alignment flags, have no idea may is.

thanks help.

if guess, i'd endl being left aligned , padded 3 characters, 2 characters appearing after return show @ beginning of next line. none on first line , alone on last line. try setting field width 1 before outputting endl.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -