编译错误
prog.c: In function ‘main’:
prog.c:8:2: warning: implicit declaration of function ‘scanf_s’ [-Wimplicit-function-declaration]
scanf_s("%f,%f,%f,%f", &x1, &x2, &y1, &y2);
^~~~~~~
/home/BRBLqY/cc0ysGb4.o: In function `main':
prog.c:(.text.startup+0x30): undefined reference to `scanf_s'
collect2: error: ld returned 1 exit status
代码
#include<stdio.h>
#include<math.h>
int main()
{
float x1, x2, y1, y2,D;
printf("\nEnter values of x1,x2,y1,y2");
scanf_s("%f,%f,%f,%f", &x1, &x2, &y1, &y2);
D = sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)));
printf("\nThe distance is %f ", D);
return 0;
}