อาจารย์ที่ รร. ส่งการบ้านให้ไปเขียนโปรแกรมภาษา C ให้มีเกี่ยวกับการคำนวนด้วย ผมเลยจะเอา โปรแกรมแยกตัวประกอบ ผมลองทำแล้วแต่คำตอบที่ได้มันไม่ตรง ผมไม่รู้ว่ามันผิดตรงไหนรบกวนเพื่อนๆด้วยนะครับ
ปล.อาจารย์เขา สอนแค่ #include <stdio.h> กับ #include <conio.h> แค่นี้อ่าครับ ถ้าโปรแกรมใช้มากกว่านี้ผมคงจนปัญญา ^^
ปล2.ผมใช้ Dev C++ เขียนครับ
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้#include <stdio.h>
#include <conio.h>
#include <math.h>
main()
{
double a,b,c;
double ans1,ans2,ans3,ans12,ans11;
printf("Position a , b and c like this \n");
printf("ax^2 + bx +c\n\n");
printf("Example : x^2 + 5x + 6\n\n");
printf("a = 1 \n");
printf("b = 5 \n");
printf("c = 6 \n");
printf("INPUT a = ");
scanf("%lf",&a);
printf("\n");
printf("INPUT b = ");
scanf("%lf",&b);
printf("\n");
printf("INPUT c = ");
scanf("%lf",&c);
printf("\n");
ans1=-b/2*a;
ans2=b*b-4*a*c;
ans3=sqrt(ans2)/2*a;
ans12=ans1+ans3;
ans11=ans1-ans3;
printf("x = %lf , %lf ",ans12,ans11);
getch();
}
การบ้านภาษา C ครับ รบกวนเพื่อนๆด้วยนะครับ
ปล.อาจารย์เขา สอนแค่ #include <stdio.h> กับ #include <conio.h> แค่นี้อ่าครับ ถ้าโปรแกรมใช้มากกว่านี้ผมคงจนปัญญา ^^
ปล2.ผมใช้ Dev C++ เขียนครับ
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้