Claudio Baglioni Forum - Un mondo in musica

Disequazioni di II grado - risoluzione

« Older   Newer »
 
  Share  
.
  1.  
    .
    Avatar

    Millennium Member

    Group
    Administrator
    Posts
    112,793
    Location
    Milano

    Status
    Offline
    Disequazioni di II grado - risoluzione


    Program DisequazioneDi2grado;

    uses crt;

    var a,b,c,x1,x2,delta:real;

    segno:char;

    r:char;



    BEGIN

    r:='s';

    While r='s' do

    Begin

    clrscr;

    Textcolor(white);

    write('Inserisci il coefficiente della x al quadrato ---> ');

    readln(a);

    write('Inserisci il coefficiente della x ---> ');

    readln(b);

    write('Inserisci il coefficiente del termine noto ---> ');

    readln(c);

    write ('Inserisci il segno ---> ');

    readln(segno);

    Begin

    delta:=(b*b)-(4*a*c);

    Writeln('Il delta e'': ',delta:1:2);

    end;



    Begin

    if (delta>0) then

    begin

    x1:=(-b-sqrt(delta))/(2*a);

    x2:=(-b+sqrt(delta))/(2*a);

    Writeln('Le due radici sono:');

    Writeln('x1= ',x1:1:2);

    Writeln('x2= ',x2:1:2);

    Textcolor(31);Writeln('PREMI INVIO PER CONTINUARE --->');

    Readln;

    Textcolor(white);

    if (a>0) and (segno='>') or (a0) and (segno='>=') or (a0) and (segno='')) then

    Begin

    Writeln('La disequazione ammette soluzioni interne');

    Writeln(x1:1:2,' < x < ,',x2:1:2);

    End;

    if (a>0) and (segno='=') then

    Begin

    Writeln('La disequazione ammette soluzioni interne');

    Writeln(x1:1:2,' ');

    Writeln('x1= ',x1:1:2);

    Writeln('x2= ',x2:1:2);

    Textcolor(31);Writeln('PREMI INVIO PER CONTINUARE --->');

    Readln;

    Textcolor(white);

    if ((a>0) and (segno='>')) or ((a0) and (segno='>=') or (a0) and (segno='')) then

    Writeln('Per nessun valore di x');

    if ((a>0) and (segno='=')) then

    Writeln('Solo per x=x1=x2');

    End;



    if delta0) and (segno='>')) or ((a0) and (segno='>''=') or (a0) and (segno='')) then

    Writeln('Per nessun valore di x');

    if ((a>0) and (segno='''=')) then

    Writeln('Per nessun valore di x');

    End;

    End;



    Textcolor(31);Write('Vuoi riutilizzare il programma? (s/n) ---> ');

    Readln(r);

    if r='s' then r:='s'

    else r:='n';

    End;

    Repeat Until Keypressed;



    END.
     
    Top
    .
0 replies since 5/3/2011, 14:40   64 views
  Share  
.