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? h�nh 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? h�nh 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� c�c v�ch chia ��n v� tr�n tr�c 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� tr�n tr�c Ox}
             begin
                Moveto(x0+dvx*i-3, y0+12);          { l�i 3 �� ch� s� ��� x�ng v�i v�ch}
                Str(i,Nr);
                outtext(Nr);
             end;
                Moveto(x0+dvx*7-13, y0-12);
                outtext('x');
                                                { V� c�c v�ch chia ��n v� tr�n tr�c  Oy}
          for i:=2 TO 6 DO
             LINE (X0-2, dvy*i, X0+2, dvy*i);
                                                { ��nh s� tr�n tr�c 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� h�m s� SIN v�i 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.078 seconds.
bao ky nam , Thuoc nam ky dieu
chu ky so