标题:新手请教
取消只看楼主
zyafx
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-7-19
 问题点数:0 回复次数:1 
新手请教
请问加什么语句才能让输出的只控制在小数点两位?比如105.88.先谢过。
#include <iostream>
#include <stdio.h>
#include <iomanip>
void main(void)
{
    float value = 36;
    float t1,t2,t3,t4;
    t1=value/0.34;
    t2=value/0.43;
    t3=value/0.52;
    t4=value/0.61;
    cout << "1: " << t1 << endl;
         cout << "2: " << t2 << endl;
    cout << "3: " << t3 << endl;
    cout << "4: " << t4 << endl;
    
}
搜索更多相关主题的帖子: include 小数点 
2008-06-02 00:13
zyafx
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-7-19
得分:0 
感谢
2008-06-02 17:33



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-217093-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.226913 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved