السلام عليكــم ورحمـة الله وبركاتــه ،،
اخواني .. عندي برنامجين .. بلغه الـ C ..
حاولت حلهم بنفسي .. ولكن لعدم توفر البرنامج لدي .. احببت ان تساعدوني في حلها .. الله يوفقكم ..
عندي امتحان فيه .. وهذي نماذج من أسئلة ..
Question 1: )
The equation of a line is given by y=mx+c where m is the slope and c is the intercept.
If given 2 points of the line, then m is given by
m=(y2-y1)/(x2-x1)
The intercept c represents the intersection of the line with y axis i.e. whose x=0.
The particular cases are:
x=x1 (or x2) in case x1=x2
y=y1 (or y2) in case y1=y2
in case the line passes by the origin it should be displayed as y=mx.
In case y1=y2 and x1=x2, the points are identical and they cannot form a line.
You program will prompt the user for the coordinates of 2 points P1(x1,y1) and P2(x2,y2) and displays the equation of the line according to the cases cited above.
Write a function to display 2 or 3 lines at the top (once your program is executed) indicating what your program is doing.
The following sample runs highlights the different cases. I am not displaying what the program is doing in my sample runs but you should do that in your homework.
You should separate between c>0 case and c<0 case i.e. the equation should not appear as for example y=0.55x+-6.78. It should appear in this case as y=0.55x-6.78

****
Write a program that reads the coefficients a, b, and c of a quadratic equation and displays the roots of this equation.
The discriminant of the equation is given by
The equation will have:
2 distinct roots if ∆>0
1 repeated root if ∆=0
2 distinct complex roots if ∆<0
