program kv_ur; var a,b,c,d,e,f,g,h,i,j,k: real; begin writeln ('Программа для решения квадратных уравнений by NEKIT. Вам нужно ввести а,b и с (коэффициент при х-квадрат, коэффициент при х и свободный коэффициент)'); readln (a); readln (b); readln ( c ); writeln (Сверьте уравнение: ',a,'x в квадрате+',b,'x','+',c,' = 0'); j:=sqr(b); k:= 2*a; if (a>0) then d:=j-4*a*c; if (a>0) then d:=j-4*a*c; if a=0 then writeln ('Уравнение нерешаемо!(так как коэффициент при х-квадрат равен нулю); if d<0 then writeln ('Корней нет!'); if (d>=0) and (a<0) then i:=sqrt(j-4*a*c); if (d>=0) and (a>0) then i:=sqrt(j-4*a*c); e:= (-b+i)/2*a; f:= (-b-i)/2*a; g:=e+f; h:=e*f; if (d>=0) and (a<0) then writeln ('Дискриминант равен ',d, ', ', 'следовательно, корни находятся по формуле -b + 4ас - - ', '-',b,'+-',i,'/',k); if (d>=0) and (a>0) then writeln (''Дискриминант равен ',d, ', ', 'следовательно, корни находятся по формуле -b + 4ас - - ', '-',b,'+-',i,'/',k); if (d=0) and (a<0) then writeln ('Корень равен ',e); if (d=0) and (a>0) then writeln ('Корень равен ',e); if (d>0) and (a<0) then writeln ('Первый корень равен ',e,', ','второй - ',f,'.'); if (d>0) and (a>0) then writeln ('Первый корень равен ',e,', ','второй - ',f,'.'); if (d>0) and (a<0) then writeln ('Сумма корней равна ',g,', ','произведение - ',h,'.'); if (d>0) and (a>0) then writeln ('Сумма корней равна ',g,', ','произведение - ',h,'.'); end.
А чё там не пашет? Ты попробуй все readln'ы переписать, а еще после каждой строки, кроме begin'а, должны стоять точка с запятой. Попробую, когда домой приду,сам .pas выложить.
Вот рабочая версия тока там всё по английски тк у меня нет рус паскаля
Code
var a,b,c,d,e,f,g,h,i,j,k: real; begin writeln ('Programs by NEKIT'); writeln('a='); readln (a); writeln('b='); readln (b); writeln('c='); readln (c); writeln ('Check the equation: ',a,'x squared+',b,'x','+',c,' = 0'); j:=sqr(b); k:= 2*a; if (a>0) then d:=j-4*a*c; if (a>0) then d:=j-4*a*c; if a=0 then writeln ('The equation of anticipation! (As the coefficient of x-squared equals zero)'); if d<0 then writeln ('No Roots!'); if (d>=0) and (a<0) then i:=sqrt(j-4*a*c); if (d>=0) and (a>0) then i:=sqrt(j-4*a*c); e:= (-b+i)/2*a; f:= (-b-i)/2*a; g:=e+f; h:=e*f; if (d>=0) and (a<0) then writeln ('Discriminant= ',d, ', ', 'hence, the roots are on the formula-b + 4ac - - ', '-',b,'+-',i,'/',k); if (d>=0) and (a>0) then writeln ('Discriminant=',d, ', ', 'hence, the roots are on the formula-b + 4ac - - ', '-',b,'+-',i,'/',k); if (d=0) and (a<0) then writeln ('Roots = ',e); if (d=0) and (a>0) then writeln ('Roots = ',e); if (d>0) and (a<0) then writeln ('First roots = ',e,', ','Second - ',f,'.'); if (d>0) and (a>0) then writeln ('First roots = ',e,', ','Second - ',f,'.'); if (d>0) and (a<0) then writeln ('The amount of roots = ',g,', ','creation - ',h,'.'); if (d>0) and (a>0) then writeln ('The amount of roots = ',g,', ','creation - ',h,'.'); end.
Добавлено (07.05.2010, 13:00) --------------------------------------------- Вот сам .pas
Сообщение отредактировал Danvir - Суббота, 08.05.2010, 12:45