pascal10000
Nombre de messages : 812 Localisation : Troyes Date d'inscription : 05/02/2011
| Sujet: Re: finition du program trigo Sam 30 Juil 2016 - 19:11 | |
| voici le source - Code:
-
dim CY,CX,sinu,csinu,tang,ctang,seca,cseca,degre dim A,B,C,D,degre$
full_space 0 color 0,0,0,0 label trr,triangleR,window,determine,vider,onclick,inverse on_click 0,trr pythagore() main_menu 1 sub_menu 2 parent 2,1 caption 2,"Determination" on_click 2,window end
trr: pythagore() if message_input("Angle", "Indiquez un angle" , "")=1 degre=message_text$ print_locate 0,30 degrees ctang=cos(degre)/sin(degre) print "cotangente "+str$(degre)+"°="+str$(ctang) 2d_pen_color 125,0,0 2d_line CX,CY-100,CX+(ctang*100),CY-100
tang=tan(degre) print "tangente "+str$(degre)+"°="+str$(tang) 2d_pen_color 0,125,0 2d_line CX+100,CY,CX+100,CY-(tang*100) csinu=cos(degre) print "cosinus "+str$(degre)+"°="+str$(csinu) 2d_pen_color 0,0,125 2d_line CX,CY,CX+(csinu*100),CY sinu=sin(degre) print "sinus "+str$(degre)+"°="+str$(sinu) 2d_pen_color 125,0,125 2d_line CX+(csinu*100),CY,CX+(csinu*100),CY-(sinu*100)
cseca=1/sin(degre) print "cosécante "+str$(degre)+"°="+str$(cseca) 2d_pen_color 125,125,125 if degre=>45 2d_line CX,CY,CX+100,CY-(tang*100) else 2d_line CX,CY,CX+(ctang*100),CY-100 end_if
seca=1/cos(degre) print "sécante "+str$(degre)+"°="+str$(seca) 2d_pen_color 200,125,125 if degre=>45 2d_line CX,CY,CX+(ctang*100),CY-100 else 2d_line CX,CY,CX+100,CY-(tang*100) end_if end_if return
' fenêtre qui représent les cotes du triangle rectangle determine: if object_exists(100)=0 form 100 width 100,600 : left 100,(screen_x-600)/2 height 100,500 : top 100,(screen_y-500)/2 caption 100,"Figure" color 100,0,0,0 2d_target_is 100 font_color 0,255,255,255 end_if show 100 on_close 100,ferme return
window: if object_exists(200)=0 form 200 width 200,400 : left 200,10 height 200,210 : top 200,(screen_y-210)/2 caption 200,"Element" color 200,0,0,0 label ferme: on_close 200,ferme command_target_is 200 edit 201:left 201,50:top 201,15:width 201,300 font_color 201,0,0,0 edit 202:left 202,50:top 202,45:width 202,300 font_color 202,0,0,0 edit 203:left 203,50:top 203,75:width 203,300 font_color 203,0,0,0 edit 204:left 204,50:top 204,105:width 204,300 font_color 204,0,0,0
button 205:left 205,(width(200)-width(205))/2:top 205,135:caption 205,"OK" on_click 205,triangleR gosub determine end_if show 100 show 200 2d_target_is 100 print_target_is 200 gosub vider
font_color 200,255,255,255 print_locate 0,20 print "Cote A=" print_locate 0,50 print "Cote B=" print_locate 0,80 print "Cote C=" print_locate 0,110 print " Angle=" return
triangleR: 2d_clear if text$(201)<>"" then A=text$(201) if text$(202)<>"" then B=text$(202) if text$(203)<>"" then C=text$(203) if text$(204)<>"" then degre=text$(204) degrees
if B>1 and C>1 A=sqr((C*C)+(B*B)) text 201,A degre=atn(C/B) gosub inverse origine() gosub onclick return end_if if A>1 and B>1 if A=B message "Calcul impossible" gosub vider return end_if
if B<A C=sqr((A*A)-(B*B)) end_if if A<B C=sqr((B*B)-(A*A)) end_if text 203,C degre=atn(C/B) gosub inverse origine() gosub onclick return end_if
if A>1 and C>1 if A=C message "Calcul impossible" gosub vider return end_if if C<A B=sqr((A*A)-(C*C)) end_if if A<C B=sqr((C*C)-(A*A)) end_if
degre=atn(C/B) text 202,B gosub inverse origine() gosub onclick return end_if
' section par raport à l'angle if A>1 and degre>1 B=A*cos(degre) text 202,B C=A*sin(degre) text 203,B gosub inverse origine() gosub onclick return end_if
if B>1 and degre>1 C=B*tan(degre) text 203,C A=sqr((C*C)+(B*B)) text 201,A gosub inverse origine() gosub onclick return end_if if C>1 and degre>1 B=C*tan(degre) text 202,B A=sqr((C*C)+(B*B)) text 201,A gosub inverse origine() gosub onclick return end_if return
inverse: degre$=str$(int(degre))+"°" text 204,degre$ return
onclick: on_click 201,vider on_click 202,vider on_click 203,vider on_click 204,vider return
vider: 2d_clear off_click 201 off_click 202 off_click 203 off_click 204 A=0 B=0 C=0 degre=0 text 201,"" text 202,"" text 203,"" text 204,"" return
ferme: hide 100 hide 200 active 0 2d_target_is 0 print_target_is 0 return
sub origine() cx= (600-(B*10))/2 cy= 500/2+((C*10)/2) 2d_pen_color 0,250,0 2d_line cx,cy,cx+(B*10),cy 2d_pen_color 250,0,0 2d_line cx,cy,cx,cy-(C*10) 2d_pen_color 0,0,250 2d_line cx,cy-(C*10),cx+(B*10),cy end_sub
sub pythagore() font_color 0,255,255,255 cy=height(0)/2 cx=width(0)/2 2d_pen_color 250,250,250 2d_clear 2d_circle cx,cy,100 2d_line cx,cy,cx+100,cy 2d_line cx,cy,cx,cy-100 print "cliquer sur la fenêtre pour déterminer un angle" end_sub | |
|