由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - C++ output format problem
相关主题
C++ formatted output question问一个C++文件读取的问题
Pyspark 怎么format output?in C++ how to write file in gzip format directly?
A C++ Questiontwo general C++ question
C#的formated output有点不方便呀。。。。问一个Fortran和C++科学数值格式输出区别的问题
c++ 是否也有class method??要学python了 有点不爽啊
C++ template question with friend ostream怎么设计这个client
question about "popen" in C/C++MatLab Code
问一道C++面试题C -> assembly
相关话题的讨论汇总
话题: output话题: swprintf话题: c++话题: 1000话题: 10
进入Programming版参与讨论
1 (共1页)
S******y
发帖数: 1123
1
I am writing out my output to a txt file. It should be like -
10:
1.687
2.999
4.752
2.876
1.086
3.478
4.326
2.836
1.563
5.000
1000:
3.157
3.480
3.118
but now it is being output like this,which is wrong -
10:
1.6872.9994.7522.8761.0863.4784.3262.8361.5635.0001000:
3.1573.4803.118
where 10 and 1000 are ids, the other numbers are predicted ratings.
====================================================================
All I did was - changing "swprintf" in the original code to "_snprintf"
in the code
X****r
发帖数: 3557
2
"%5.3f"改为"%5.3f\n"

【在 S******y 的大作中提到】
: I am writing out my output to a txt file. It should be like -
: 10:
: 1.687
: 2.999
: 4.752
: 2.876
: 1.086
: 3.478
: 4.326
: 2.836

S******y
发帖数: 1123
3
Thanks!
Why "/n" was not needed in the original code (wide character)? i.e.
swprintf(pwzBuffer,1000,L"%5.3f",rating);

【在 S******y 的大作中提到】
: I am writing out my output to a txt file. It should be like -
: 10:
: 1.687
: 2.999
: 4.752
: 2.876
: 1.086
: 3.478
: 4.326
: 2.836

1 (共1页)
进入Programming版参与讨论
相关主题
C -> assemblyc++ 是否也有class method??
Angular formating Q: {{(mysystem.freeMem / myststem.totalMem) * 100}}%C++ template question with friend ostream
predictive analysis只能用来prediction吧?question about "popen" in C/C++
[转载] 简单的题都不敢做了.问一道C++面试题
C++ formatted output question问一个C++文件读取的问题
Pyspark 怎么format output?in C++ how to write file in gzip format directly?
A C++ Questiontwo general C++ question
C#的formated output有点不方便呀。。。。问一个Fortran和C++科学数值格式输出区别的问题
相关话题的讨论汇总
话题: output话题: swprintf话题: c++话题: 1000话题: 10