-
List item
#include<stdio.h>
int one_three(void);
/platinum.c – your weight in platinum/
#include<stdio.h>
int main(void) {
double weight; /*你的体重 */
double value; /相当于重量的白金价值/printf(“Are you worth your weight in platinum?\n”);
printf(“Let’s check it out.\n”);
printf(“Please enter your weight in pounds:”);/*获取用户的输入 */
scanf_s("%lf", & weight);
/*假设白金的价格是每盎司$1700 */
/14.5833用于把英镑常衡盎司转换为金衡盎司/
value = 1700.0 * weight * 14.5833;
printf(“Your weight in platinum is worth $%.2f.\n”, value);
printf(“You are easily worth that! If platinum prices drop,\n”);
printf(“eat more to maintain your value.\n”);
getchar();
getchar();
}
注意更改:Scanf_s("%f“",&weight);
在某些集成开发环境(IDE)下编写的代码中插入getchar();语句,程序在执行完毕后不会立即关闭执行窗口。
使用 Visual Studio 2019