C++编程题,求大神指教,实在是小白不会。已知速度和时间和加速度。框架也有了,但是真的不太会
C++编程题,求大神指教,实在是小白不会。已知速度和时间和加速度。框架也有了,但是真的不太会求各位大佬救救孩子吧,悬赏再翻倍都可以...
C++编程题,求大神指教,实在是小白不会。已知速度和时间和加速度。框架也有了,但是真的不太会求各位大佬救救孩子吧,悬赏再翻倍都可以
展开
4个回答
展开全部
Firstly, you need bulid up two mathematical equations to calculate the velocity and the acceleration.
double calculate_velocity( double& t ) {
return 1e-5*t*t*t - 0.00488*t*t + 0.75795*t + 181.3566;
}
double calculate_acceleration( double& v ) {
return 3.0 - 0.000062*v*v;
}
Secondly, you need to pay attention to the decmial point of your calculated result, which need to fix the length of double variable by
printf( "Velocity = %.3f m/s\n", velocity );
printf( "Acceleration = %.3f m/s^2\n", acceleration );
If you fill in these two pieces of codes inside the original programme, the sample should looks like:
#include <stdio.h>
#include <math.h>
double calculate_velocity( double& t ) {
return 1e-5*t*t*t - 0.00488*t*t + 0.75795*t + 181.3566;
}
double calculate_acceleration( double& v ) {
return 3.0 - 0.000062*v*v;
}
int main( void ) {
// Declare variables
double time;
double velocity;
double acceleration;
// Get time value from the keyboard
printf( "Enter new time value in seconds:\n");
scanf( "%lf", &time );
// Compute velocity and acceleration
velocity = calculate_velocity( time );
acceleration = calculate_acceleration( velocity );
// Print velocity and acceleration
printf( "Velocity = %.3f m/s\n", velocity );
printf( "Acceleration = %.3f m/s^2\n", acceleration );
// Exit the program
return 0;
}
The generated result will look exactly as you expected as
展开全部
这要解决问题一个字都懒的打,能解决吗
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
来个大神吧,我也不会c++呀
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询