永发信息网

使用vs2013 出错了,怎么解决 ,程序应该是对的 但是还是有错误提示

答案:2  悬赏:70  手机版
解决时间 2021-04-10 18:47
  • 提问者网友:半生酒醒
  • 2021-04-09 21:15
#include
int mian()
{
int max(int x, int y);
int a, b, c;
printf("please into any number :");
scanf("%d,%d", &a, &b);
c = max(a, b);
printf("max is %d\n", c);
return 0;

}
错误提示是
错误 1 error 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. d:\visualstudio 2013 projects\project3\project3\源.c 7 1 Project3
最佳答案
  • 五星知识达人网友:詩光轨車
  • 2021-04-09 21:57
这个解决起来很简单。
在VS2013中,认为scanf是一个不安全的函数,所以VS不推荐使用。让你把scanf函数换成scanf_s 函数。

scanf("%d,%d", &a, &b);改成
scanf_s("%d,%d", &a, &b);就可以解决编译错误。
全部回答
  • 1楼网友:洎扰庸人
  • 2021-04-09 22:02
你的编译成功了咩? main前面要加类型吧。我加了之后就编译通过了,生成的exe也能运行。如果只是这个程序这样,那就是程序的问题,如果你写个helloworld都这样,应该就是软件环境没配置好吧。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯