Sieu ho tro Homepage
Forum Home Forum Home > Information Technology > The programming language > Turbo Pascal,Turbo C
  New Posts New Posts RSS Feed - V? d? th? hnh sin
  FAQ FAQ  Forum Search   Events   Register Register  Login Login


V? d? th? hnh sin

 Post Reply Post Reply
Author
Message
Poster View Drop Down
Guest
Guest
Avatar

Joined: 23 January 2008
Status: Offline
Points: 378
Post Options Post Options   Thanks (0) Thanks(0)   Quote Poster Quote  Post ReplyReply Direct Link To This Post Topic: V? d? th? hnh sin
    Posted: 21 August 2008 at 20:00
PROGRAM  VE_DO_THI_HAM_SO_SIN;
USES
 CRT, GRAPH;
 VAR
            I,M1,M2,dvx,dvy:integer;
            Device,Mode,X0,Y0,P,Q:integer;
            Nr: String;
 BEGIN
   ClrScr;
   InitGraph(Device,Mode,'C:\tp70\bgi');
 
   If GraphResult<>0 then
       Begin
          Write('Loi do hoa! ', GraphErrorMsg(GraphResult) );
          Exit;
       End;
          m1:=GetMaxX; m2:=GetMaxY;
          dvx:=64;{ m1 div 10;}
          dvy:=48;{  m2 div 10;}
          x0:= 2* dvx;
          y0:= 4* dvy ;
              { Ve 2 truc toa do }
          Line (dvx,y0,9*dvx,y0);   { Truc Ox}
          Line (x0,dvy,x0,7*dvy);   { Truc Oy}
 
                                                { V cc vch chia n v trn trc Ox}
          for i:=1 TO 6 DO
             LINE (X0+Dvx*I, Y0-2, X0+Dvx*I, Y0+2);
 
          for i:=1 TO 6 DO          { nh s trn trc Ox}
             begin
                Moveto(x0+dvx*i-3, y0+12);          { li 3 ch s xng vi vch}
                Str(i,Nr);
                outtext(Nr);
             end;
                Moveto(x0+dvx*7-13, y0-12);
                outtext('x');
                                                { V cc vch chia n v trn trc  Oy}
          for i:=2 TO 6 DO
             LINE (X0-2, dvy*i, X0+2, dvy*i);
                                                { nh s trn trc Oy}
          for i:=-2 to 2 do
             Begin
              Moveto(x0-40,y0-i*dvy-3);
              Str((i* 0.5):3:1,Nr);
              If i<0 then Outtext(Nr) else if i>0 then Outtext(' '+Nr);
             End;
          Moveto(x0-10,y0-3*dvy+5);  outtext('Y');
 
                 { V th hm s SIN vi h s t l an-pha = PI/2 dvx, be-ta=2dvy  }
 
          for i:=0 to 7*dvx do
             PutPixel (x0+i,y0-trunc(2*dvy*sin(i*pi/(2*dvx)) ),yellow );
 
          Moveto(250, 350);
          Outtext(' Do thi ham so Y = SIN(X)');
          readln;
          CloseGraph;
  END.
Back to Top
Sponsored Links


Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.

This page was generated in 0.156 seconds.
bao ky nam , Thuoc nam ky dieu
C?a thp ch?ng chy,cua thep chong chay,c?a ch?ng chy,cua chong chay,c?a nh?a abs,cua nhua abs,c?a abs,cua abs,cua thep van go,c?a thp vn g?,c?a thp an ton,cua thep an toan,c?a cu?n ch?ng chy,cua cuon chong chay,c?a g? ch?ng chy,cua go chong chay,c?a tru?t t? d?ng,cua truot tu dong,c?a knh ch?ng chy,cua kinh chong chay