我创建了一个小型应用程序,通过使用带参数的用户定义函数来查找最大数量。当我运行它时,它会显示此消息
错误 1 错误 C4996:“scanf”:此函数或变量可能不安全。考虑改用 scanf_s。要禁用弃用,请使用 _CRT_SECURE_NO_WARNINGS。详细信息请参见在线帮助。
我该怎么做才能解决这个问题?
这是我的代码
#include<stdio.h>
void findtwonumber(void);
void findthreenumber(void);
int main() {
int n;
printf("Fine Maximum of two number\n");
printf("Fine Maximum of three number\n");
printf("Choose one:");
scanf("%d", &n);
if (n == 1)
{
findtwonumber();
}
else if (n == 2)
{
findthreenumber();
}
return 0;
}
void findtwonumber(void)
{
int a, b, max;
printf("Enter a:");
scanf("%d", &a);
printf("Enter b:");
scanf("%d", &b);
if (a>b)
max = a;
else
max = b;
printf("The max is=%d", max);
}
void findthreenumber(void)
{
int a, b, c, max;
printf("Enter a:");
scanf("%d", &a);
printf("Enter b:");
scanf("%d", &b);
printf("Enter c:");
scanf("%d", &c);
if (a>b)
max = a;
else if (b>c)
max = b;
else if (c>a)
max = c;
printf("The max is=%d", max);
}