-3
嗨,我是一个C++初学者,我真的不能让我的头绕着这个错误 从'double'到'int'的转换需要缩小转换 这是我的码; #include“Segment.h” using namespace imat1206;从'双'转换为'int'需要缩小转换
Segment::Segment(int new_speed_limit
, int new_end, double new_length, double new_deceleration)
:the_speed_limit{ new_speed_limit }
, the_end{ new_end }
, the_length{ new_length }
, deceleration{ new_deceleration }
{}
Segment::Segment(double new_end, double new_acceleration)
:the_end{ new_end }
, acceleration{ new_acceleration }
{} error here
double Segment::to_real() const {
return static_cast<double>((the_end)*(the_end)/(2 * (the_length)));
while (acceleration)
{
(acceleration >= 0);
return static_cast<double> ((the_end) /(1 * (acceleration)));
}
}
请别人帮助的感谢
我得到的错误是:错误C2397:从“双”到“廉政”的转换需要一个收缩转换
指示哪条线路导致错误。 –
您需要包含一个正确的[mcve],在这种情况下,包括与此类关联的.h文件。从上下文中不清楚发生错误的位置。 – Xirema
@NeilButterworth谢谢我 – yoyooyoyo