您的位置:首页 > 编程语言 > Qt开发

QT小数点保留问题

2011-07-01 09:31 429 查看
1. QString stry;
double y;
y = 6.44;
stry = QString::number(y,'f',1);

//stry = stry.number(y,'f',1);

2. 其中’f’表示以什么样的格式输出:
Format Meaning
e format as [-]9.9e[+|-]999
E format as [-]9.9E[+|-]999
f format as [-]9.9
g use e or f format, whichever is the most concise
G use E or f format, whichever is the most concise
3. 小数点后保留几位?
1表示保留一位。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: