邝(kuàng) 2021-09-04 17:31 采纳率: 100%
浏览 239
已结题

从“double”到“float”截断是什么意思

img

#include<iostream>
using namespace std;
int main()
{
    const float PI = 3.14;
    float r, s, v;
;
    cout << "输入球体的半径:r=" << endl;
    cin >> r;
    s = 4*PI * r * r;
    v = 4.0/3*PI * r * r * r;
    cout << "球的体积是:" << v << endl << "球的表面积是:" << s << endl;

    return 0;
}

已启动重新生成…
1>已启动全部重新生成: 项目: hello world, 配置: Debug x64
1>helloworld.cpp
1>D:\C++opencv_program\hello world\helloworld.cpp(5,23): warning C4305: “初始化”: 从“double”到“float”截断
1>D:\C++opencv_program\hello world\helloworld.cpp(11,23): warning C4244: “=”: 从“double”转换到“float”,可能丢失数据
1>hello world.vcxproj -> D:\C++opencv_program\hello world\x64\Debug\hello world.exe
1>已完成生成项目“hello world.vcxproj”的操作。
全部重新生成: 成功 1 个,失败 0 个,跳过 0 个

这个warning的意思是什么呢?

  • 写回答

2条回答 默认 最新

查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 9月16日
  • 已采纳回答 9月8日
  • 创建了问题 9月4日

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端