01/10/2018, 16:07
[Error] ld returned 1 exit status
void Bacnhat(float a,float b,float c){
printf("Phuong trinh co 1 nghiem duy nhat:
x = %f", -c/a);
}
//---------------------------------------------------------------------------------------
float DelTa(float a, float b, float c){
float delta= b*b-4*a*c;
return delta;
}
//-------------------------------------------------------------------------------------
void HaiNghiem(float a,float b,float c,float delta){
float x1=(-b+sprt(delta))/2*a;
float x2=(-b-sprt(delta))/2*a;
printf("Phuong trinh co 2 nghiem phan biet:
x1 = %f
x2 = %f", x1, x2);
}
//---------------------------------------------------------------------------------------
void NghiemKep(float a,float b){
printf("Phuong trinh co nghiem kep:
x1= x2 = %f", -b/(2*a));
}
//--------------------------------------------------------------------------------------
void VoNghiem(){
printf("Phuong trinh vo nghiem");
}
//------------------------------------------------------------------------------------------
main()
{
float a,b,c,delta;
printf("PTB2: a*x^2+b*x+c=0
Nhap vao a, b, c: ");
scanf("%f %f %f", &a, &b, &c);
delta=DelTa(a,b,c);
if (a==0) Bacnhat(a,b,c);
else if (delta>0) HaiNghiem(a,b,c,delta);
else if (delta==0) NghiemKep(a,b);
else if (delta<0) VoNghiem();
getchar();
return 0;
}
Mình mới làm quen với c, mấy bạn cho mình hỏi tại sao mình chạy code cứ bị lỗi:
[Error] ld returned 1 exit status
mình đã cài lại devC và kiểm tra task manager nhưng vẫn bị lỗi
Bài liên quan
bạn thử thay hàm
main()
thànhint main()
xem saoMình đã tìm thấy lỗi, thật ra mình ghi sai hàm chứ ko phải do lỗi j cả, cảm ơn bạn