Today's study uses the program of "C Program Design (fourth edition)" To find the maximum value of two numbers.
Devcpp Program:
#include <stdio.h>
int main ()
{
int max (int x,int y);
int a,b,c;
scanf ("%d,%d", &a,&b);
C=max (A, b);
printf ("max=%d\n", c);
System ("pause");
return 0;
}
int max (int x,int y)
{
int z;
if (x<y) z=y;
else z=x;
printf ("%d\n", z);
return (z);
}
VS2017 Program:
#include <stdio.h>
int main ()
{
int max (int x,int y);
int a,b,c;
scanf_s ("%d,%d", &a,&b);
C=max (A, b);
printf ("max=%d\n", c);
System ("pause");
return 0;
}
int max (int x,int y)
{
int z;
if (x<y) z=y;
else z=x;
printf ("%d\n", z);
return (z);
}
' scanf ': This function/variable may be unsafe, consider using scanf_s to replace it. If you want to ignore this warning, use the macro _crt_secure_no_warnings
Referenced from "http://bbs.csdn.net/topics/390508208?page=1"
Error encountered:
1, Chinese and English characters problem: The Input method is the default language, in the editing interface for the English, but run the popup automatically switch back to Chinese, enter a comma between two numbers is Chinese, resulting in a program run error.
2, in the test, in order to eliminate the problem using scanf ("%d,%d", &a,&b), when the variable before forgetting to add &, causing the program to run an error.
A record of mistakes made in the programming of C language Program (i)