void Bacnhat(float a,float b,float c){
printf("Phuong trinh co 1 nghiem duy nhat:\nx = %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:\nx1 = %f\nx2 = %f", x1, x2);
}
//---------------------------------------------------------------------------------------
void NghiemKep(float a,float b){
printf("Phuong trinh co nghiem kep:\nx1= 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\nNhap 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
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?