Question 1 :
#define MaxN 100 #define MaxB (2*MaxN - 3) typedef struct noeud {float x;float y;int nb;} noeud; typedef struct barre {int n1;int n2;float lng;} barre; typedef noeud tabnoeud[MaxN]; typedef barre tabbarre[MaxB]; /* déclarations globales car doivent être accessibles partout */ int nbn,nbb; tabnoeud tn; tabbarre tb; void saisie_geometrie(void) //pas d'arguments car variables globales { int i,n1,n2; printf("nombre de noeuds ?"); scanf("%d",&nbn); //l'idéal serait de faire un test mais on manquait de temps for(i=0;i<nbn;i++) { printf("abscisse (x) du noeud n°%d ?",i); scanf("%f",&(tn[i].x)); printf("ordonnée (y) du noeud n°%d ?",i); scanf("%f",&(tn[i].y)); tn[i].nb=0; //initialisation pour la suite } nbb=2*nbn-3; for(i=0;i<nbb;i++) { printf("n° de la 1ère extrémité de la barre n°%d ?",i); scanf("%d",&n1); printf("n° de l'autre extrémité de la barre n°%d ?",i); scanf("%d",&n2); tb[i].n1=n1; tb[i].n2=n2; (tn[n1].nb)++; //mettre à jour les nb de barres pour ces 2 noeuds (tn[n2].nb)++; tb[i]=sqrt(sqr(tn[n2].x-tn[n1].x)+sqr(tn[n2].y-tn[n1].y)); } }
Question 2 :
typedef float ligne[MaxB]; typedef ligne matrice[2*MaxN]; void equilibre_X(int n, ligne L) { int i; for(i=0;i<nbb;i++) { if(tb[i].n1==n) L[i]=(tn[n].x-tn[tb[i].n2 ].x)/tb[i].lng; else if(tb[i].n2==n) L[i]=(tn[n].x-tn[tb[i].n1 ].x)/tb[i].lng; else L[i]=0; } } void def_matrice(matrice M) { int i; for(i=0;i<nbn;i++) { equilibre_X(i,M[2*i]); equilibre_Y(i,M[2*i+1}); } }
Question 3 : voici un exemple (il était évidement inutile d'en faire autant, en particulier inutile de donner toutes les lignes des tableaux)
<H1 ALIGN="CENTER">TREILLIS SPECIAL DESS</H1> <H1 ALIGN="CENTER">ref. pat-25-03-02</H1> <H2>Schéma :</H2> <P ALIGN="CENTER"><IMG SRC="dess02-b.jpg" WIDTH=681 HEIGHT=515 border="1"></P> <P ALIGN="CENTER">schéma tiré du livre "mécanique 1ères F, tome 1" de Lemasson et Gal (édité chez <A HREF="http://www.dunod.fr">Dunod</A>).</P> <H2>Caractéristiques :</H2> <table width="100%"> <tr> <td ALIGN="CENTER" width="60%">Description des noeuds</TD> <TD ALIGN="CENTER" width="40%">Description des barres</TD> </tr> <tr> <TD ALIGN="CENTER"> <TABLE BORDER width="80%"> <TR><TD ALIGN="CENTER">nom</TD> <TD ALIGN="CENTER">n°</TD> <TD ALIGN="CENTER">X</TD> <TD ALIGN="CENTER">Y</TD> <TD ALIGN="CENTER">nb de barres</TD> </TR> <TR><TD ALIGN="CENTER">A</TD> <TD ALIGN="CENTER">0</TD> <TD ALIGN="CENTER">0</TD> <TD ALIGN="CENTER">0</TD> <TD ALIGN="CENTER">2</TD> </TR> <TR><TD ALIGN="CENTER">B</TD> <TD ALIGN="CENTER">1</TD> <TD ALIGN="CENTER">10</TD> <TD ALIGN="CENTER">0</TD> <TD ALIGN="CENTER">2</TD> </TR> <TR><TD ALIGN="CENTER">C</TD> <TD ALIGN="CENTER">2</TD> <TD ALIGN="CENTER">2</TD> <TD ALIGN="CENTER">-0.5</TD> <TD ALIGN="CENTER">3</TD> </TR> </table> </TD> <TD ALIGN="CENTER"> <TABLE BORDER width="80%"> <TR> <TD ALIGN="CENTER">nom</TD> <TD ALIGN="CENTER">n°</TD> <TD ALIGN="CENTER">Longueur</TD> </TR> <tr> <TD ALIGN="CENTER">AI</TD> <TD ALIGN="CENTER">0</TD> <TD ALIGN="CENTER">2.28</TD> </TR> <Tr> <TD ALIGN="CENTER">AC</TD> <TD ALIGN="CENTER">1</TD> <TD ALIGN="CENTER">2.16</TD> </TR> <Tr> <TD ALIGN="CENTER">CI</TD> <TD ALIGN="CENTER">2</TD> <TD ALIGN="CENTER">1.52</TD> </TR> </TABLE> </td> </tr> <tr> <td ALIGN="CENTER">etc...</TD><TD ALIGN="CENTER">etc...</TD> </tr></table> <P>pour tout renseignement sur ce produit, envoyez un mail à <A HREF="mailto: xxxxxx@yyyyyyy.fr">xxxxxx@yyyyyyy.fr</A>.
Pour retourner au sommaire des sujets d'examen, cliquez ici. Mais peut-être aimeriez vous auparavant retourner au sujet de cet examen ?
Patrick TRAU, ULP - IPST avril 02