|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<stdio.h>
int main(void)
{
float weight;
float 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("%f", &weight);
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 main tain your value.\n");
return 0;
}
这个是编译器给出的错误解释:
错误 C4996 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
本帖最后由 sunrise085 于 2020-11-5 14:35 编辑
新版的编译器中认为scanf不安全,让使用scanf_s替换。你把scanf换乘scanf_s试试
或者在文件开头加一句:
- #define _CRT_SECURE_NO_WARNINGS
复制代码
|
|