c'est toujours sur la gestion des polynomes
2 participants
Page 1 sur 1
c'est toujours sur la gestion des polynomes
j'ai essayé de modifier mon code il compile mais la fonction creation ne marche pas, aidez moi svp; j'utilise cette fois ci "dev c++" ; j'ai vraiment besoin d'aide; je compte sur vous tous. merci d'avance.
#include<stdio.h>
#include<conio.h>
#include<string.h>
typedef struct
{
float coef;
int deg;
int suiv;
}terme;
void creation()
{
char nom[10],nompoly[10][10];
int i,j,indice=0,prec,deg;
float coeff,tempo;
terme poly [10][20];
printf(" \n entrez le nom que vous donnez au polynome:");
fflush(stdin);
gets(nom);
i=0;
while (i<indice)
{
while (strcmp(nom,nompoly[i])==0)
{
printf("ce nom est déja utilisé");
printf("donnez un autre nom");
fflush(stdin);
gets(nom);
}
i++;
}
strcpy(nompoly[i],nom);
poly[indice][0].deg=0;
poly[indice][0].coef=0;
prec=0;
poly[indice][0].suiv=1;
i=1; j=1;
do
{
printf("entrez le coefficient coeff<>0 :");
scanf("%f",&coeff);
printf("entrez le degré :");
scanf("%d",°);
if (deg!=poly[indice][prec].deg)
{
poly[indice][i].coef=coeff;
poly[indice][i].deg=deg;
poly[indice][i].suiv=i+1;
prec=i;
i++;
}
else
poly[indice][prec].coef=poly[indice][prec].coef + coeff;
j++;
poly[indice][i-1].suiv=0;
poly[indice][0].coef=i;
indice++;
getch();
}
while (coeff!=0 && i<10);
}
main()
{
char nom[10],tabnom[10][10],ch,rep;
int i,prec,deg,prod,j,choix,premier;
terme poly[10][21];
printf(" \n MENU PRINCIPAL");
printf(" \n³1: CREER UN POlYNOME ³");
printf(" \n³2: AFFICHER LA LISTE DES POLYNOMES ³");
printf(" \n³3: GESTION D'UN POLYNOME ³");
printf(" \n³4: SUPPRIMER UN POLYNOME ³");
printf(" \n³5: SOMME DE DEUX POLYNOME ³");
printf(" \n³0: QUITTER ³");
printf(" \n³ Votre choix : ³");
printf("Entrez votre choix:");
scanf("%d",choix);
switch (choix)
{
case 1: creation;
case 2: break;
}
getch();
}
#include<stdio.h>
#include<conio.h>
#include<string.h>
typedef struct
{
float coef;
int deg;
int suiv;
}terme;
void creation()
{
char nom[10],nompoly[10][10];
int i,j,indice=0,prec,deg;
float coeff,tempo;
terme poly [10][20];
printf(" \n entrez le nom que vous donnez au polynome:");
fflush(stdin);
gets(nom);
i=0;
while (i<indice)
{
while (strcmp(nom,nompoly[i])==0)
{
printf("ce nom est déja utilisé");
printf("donnez un autre nom");
fflush(stdin);
gets(nom);
}
i++;
}
strcpy(nompoly[i],nom);
poly[indice][0].deg=0;
poly[indice][0].coef=0;
prec=0;
poly[indice][0].suiv=1;
i=1; j=1;
do
{
printf("entrez le coefficient coeff<>0 :");
scanf("%f",&coeff);
printf("entrez le degré :");
scanf("%d",°);
if (deg!=poly[indice][prec].deg)
{
poly[indice][i].coef=coeff;
poly[indice][i].deg=deg;
poly[indice][i].suiv=i+1;
prec=i;
i++;
}
else
poly[indice][prec].coef=poly[indice][prec].coef + coeff;
j++;
poly[indice][i-1].suiv=0;
poly[indice][0].coef=i;
indice++;
getch();
}
while (coeff!=0 && i<10);
}
main()
{
char nom[10],tabnom[10][10],ch,rep;
int i,prec,deg,prod,j,choix,premier;
terme poly[10][21];
printf(" \n MENU PRINCIPAL");
printf(" \n³1: CREER UN POlYNOME ³");
printf(" \n³2: AFFICHER LA LISTE DES POLYNOMES ³");
printf(" \n³3: GESTION D'UN POLYNOME ³");
printf(" \n³4: SUPPRIMER UN POLYNOME ³");
printf(" \n³5: SOMME DE DEUX POLYNOME ³");
printf(" \n³0: QUITTER ³");
printf(" \n³ Votre choix : ³");
printf("Entrez votre choix:");
scanf("%d",choix);
switch (choix)
{
case 1: creation;
case 2: break;
}
getch();
}
patricia- Messages : 3
Date d'inscription : 12/02/2009
Page 1 sur 1
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|