Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. program rownania;
  2. var odpwoiedz : String;
  3. a: real ;
  4. x,y : array[1..50] of real;
  5. i:integer;
  6. plik:text;
  7.  
  8.  
  9. Function f (x:real):real;
  10. begin
  11. if x<1 then
  12. f:=2*x - cos (3*a)
  13. else
  14. f:= a* x*x +3 ;
  15. end;
  16.  
  17.  
  18. begin
  19. Writeln ('Czy rozpoczac dzialanie?') ;
  20. Readln(odpwoiedz);
  21.  
  22. if ( (odpwoiedz = 'tak') or (odpwoiedz = 'Tak') ) then
  23. begin
  24. repeat
  25.  
  26. Writeln ('Prosze o podanie liczby a');
  27. Readln (a);
  28.  
  29. until a<>0;
  30.  
  31.  
  32.  
  33.  
  34. for i:=1 to 12 do
  35. begin
  36. x[i]:=0.2 * i;
  37. y[i]:=f(x[i]);
  38.  
  39. end;
  40.  
  41.  
  42. assign (plik, 'data.dat') ;
  43. rewrite (plik);
  44. for i:=1 to 12 do
  45. writeln (plik, x[i]:0:2,' ',y[i]:0:2 );
  46.  
  47. close (plik);
  48.  
  49. end else
  50. writeln ('Program przerwany')
  51.  
  52. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement