Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Visual c ++ compares the sizes of two numbers, and there is something wrong. If you enter 1.1 and 2.2, you will output 1 (isn't shaping the number after the decimal point?)
Visual c ++ compares the sizes of two numbers, and there is something wrong. If you enter 1.1 and 2.2, you will output 1 (isn't shaping the number after the decimal point?)
#include< stdio.h>

int main()

{

int max(int x,int y);

int a,b,c;

printf("please input a,b\n");

scanf("%d,%d",& a,& b); //%d can only read plastic data. If you enter 1.1 and 2.2, a=1, and the decimal point and everything behind it can't be read, resulting in B not being assigned

C = Max (a, b);

printf("The largest is %d\n",c);

return ;

}

int max(int x,int y)

{

int z;

if(x> y)z=x;

else z=y;

return z;

}