Přidat otázku mezi oblíbenéZasílat nové odpovědi e-mailem ktory programovaci jazyk si vybrat ?

Pozri nieje jazyk ktorý by ti skúsený programátor poradil

dám ti len príklad a ty si vyber

jazyk java midlet pascal

program Testas;

var textFieldA,textFieldB,textFieldC: integer;
cmdNext : command;
cmdQuit : command;
a, b, c : integer;
D, x1, x2 : real;

function RealToString(r:real): string;
var s: string;
begin
s := IntegerToString(Trunc(r));
s := s + '.' + IntegerToString(Trunc((r-Trunc(r))*1000));
RealToString := s;
end;


begin
// switch to form mode from default canvas mode
ShowForm;

// add a text field to the form
textFieldA := FormAddTextField('Iveskite a', '', 20, TF_NUMERIC);
textFieldB := FormAddTextField('Iveskite b', '', 20, TF_NUMERIC);
textFieldC := FormAddTextField('Iveskite c', '', 20, TF_NUMERIC);

// create a command (button)
cmdNext := CreateCommand('Go!', CM_OK, 1);
AddCommand(cmdNext);

// wait until the user clickes on Go! command
repeat until GetClickedCommand = cmdNext;

// retrieve values
a:= StringToInteger(FormGetText(textFieldA));
b:= StringToInteger(FormGetText(textFieldB));
c:= StringToInteger(FormGetText(textFieldC));

// switch back to canvas mode and draw the text
ShowCanvas;

D := Sqr(b)- 4*a*c;
if D > 0 then begin
x1 := (-b - Sqrt(D)) / (2*a);
x2 := (-b + Sqrt(D)) / (2*a);
DrawText('D = ' + RealToString(D), 0, 0);
DrawText('x1 = ' + RealToString(x1), 0, 10);
DrawText('x2 = ' + RealToString(x2), 0, 20);
Repaint;
end;
if D < 0 then DrawText('Neigiamas D',0,0);

// create a quit command
cmdQuit := CreateCommand('Quit', CM_EXIT, 1);
AddCommand(cmdQuit);
repeat until GetClickedCommand = cmdQuit;
end.

jazyk pascal

program Testas;
var a, b, c : integer;
D, x1, x2 : real;
begin
WriteLn('Iveskite a, b, c');
ReadLn(a);
ReadLn(b);
ReadLn(c);
D := Sqr(b)- 4*a*c;
if D > 0 then
x1 := (-b - Sqrt(D)) / (2*a);
x2 := (-b + Sqrt(D)) / (2*a);
WriteLn('D = ', D:2:3);
WriteLn('x1 = ', x1:2:3);
WriteLn('x2 = ', x2:2:3);
if D < 0 then
WriteLn('Neigiamas D');
ReadLn;
end.

jazyk basic

rem Testas
dim a,b,c:int
dim d,x1,x2:real
print "Inveskite";:input a;:input b;:input c;
d=Sqr(b)- 4*a*c
if D > 0 then begin
x1 := (-b - Sqrt(D)) / (2*a);
x2 := (-b + Sqrt(D)) / (2*a);
print " D = "; d
print "x1 = "; x1
print "x2 = "; x2
endif
if D < 0 then print "Neigiamas D");
pause

Reakce na odpověď

1 Zadajte svou přezdívku:
2 Napište svou odpověď:
3 Pokud chcete dostat ban, zadejte libovolný text:

Zpět do poradny