注册 登录
编程论坛 C++教室

c++怎样将一个浮点型转化为整型输出??

zyh181668 发布于 2013-09-26 19:09, 765 次点击
# include "stdafx.h"
# include <iostream.h>
# include <stdlib.h>
 
int main(int argc, char* argv[])
{
    float f = 3.14;
   
    cout << (int)f << endl;

    system("pause");

    return 0;
}


除了以上的强转方式 还有别的方式吗?
1 回复
#2
未未来2013-09-26 20:25
int x=f;
cout<<x;
1