The following code:
#include <stdio.h>
#include <minmax.h>
int main( )
{
int a,b,c;
scanf("%d,%d",&a,&b);
c=max(a,b);
printf("max=%d",c);
return 0;
}
When compiling with VS2005, you will encounter such a warning:warning C4996: ' scanf ' was declared deprecated
In fact, the detailed meaning of warning C4996 is: ' scanf ': This function or variable may is unsafe. Consider using scanf_s instead. To disable deprecation, use _crt_secure_no_warnings. The scanf statement is considered unsafe in VS2005 and allows you to replace it with scanf_s.
Know the reason, the solution is convenient, as long as the #include <stdio.h> before adding #define _crt_secure_no_deprecate or scanf function modified to scanf_s can. Specifically as follows:
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include <minmax.h>
int main( )
{
int a,b,c;
scanf("%d,%d",&a,&b);
c=max(a,b);
printf("max=%d",c);
return 0;
}
Or
#include <stdio.h>
#include <minmax.h>
int main( )
{
int a,b,c;
scanf_s("%d,%d",&a,&b);
c=max(a,b);
printf("max=%d",c);
return 0;
}