Mat*_*int 2 c windows string formatting
这是我的第一个comp sci赋值的一部分,我们正在编写一个C程序来评估几个方程.这是给出了不稳定结果的代码:
// 1. Newton’s Second Law of Motion
printf("Newton's Second Law of Motion \nPlease enter mass and acceleration as decimal-point values separated by a comma (ex. 150.0,5.5): ");
scanf("%lf, %lf", &mass, &accel);
printf("Newton’s Second Law of Motion: force = mass * acceleration = %lf * %lf = %lf\n\n\n", mass, accel, mass*accel);
Run Code Online (Sandbox Code Playgroud)
程序运行时,第一个printf显示正常,但第二个显示"牛顿"而不是"牛顿".
| 归档时间: |
|
| 查看次数: |
1641 次 |
| 最近记录: |