Я только начал вводить в класс компьютерного программирования, я знаю только программирование на 2 недели. Я продолжаю получать «конфликтующие типы для« sqrt », поэтому я создал прототип, и я все еще получаю сообщение. Я все пробовал.Я продолжаю получать сообщение об ошибке: «Конфликтующие типы для« sqrt »»
#include<stdio.h>
#include<math.h>
float distance(float a, float b, float c, float d);
int main()
{
int a,b,c,d,D;
printf("Please enter the first x coordinate. x1= ");
scanf("%f",&a);
printf("Please enter the first x coordinate. y1= ");
scanf("%f",&b);
printf("Please enter the first x coordinate. x2= ");
scanf("%f",&c);
printf("Please enter the first x coordinate. y2= ");
scanf("%f",&d);
D = distance(a,b,c,d);
printf("Distance = %.4f",D);
return 0;
}
float distance(float x1, float x2, float y1, float y2)
{
float d, D, x, y, X, Y;
x = x1 - x2;
y = y1 - y2;
X = x*x;
Y = y*y;
d = X + Y;
float sqrt (float d);
}
Вы receclaring sqrt() Я думаю. Удалите инструкцию float перед sqrt() –