1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| #include <stdio.h>
#include <string.h>
extern int SaisirMot(char[], char [][]);
extern void Afficher(char[][], int);
extern void TrierTab(char[][]);
int main()
{
int choix,n;
char noms [10][20], mot[10];
do
{
printf("...:::MENU:::...\n");
printf("1.Veuillez entrers des mots\n");
printf("2.Trier le tableau par ordre alphabètique\n");
printf("3.Afficher le tableau\n");
printf("4.Quitter\n");
scanf("%d",&choix);
printf("\n");
switch(choix) // construction du tableau
{
case 1:n=SaisirMot(mot,noms);
break;
case 2:
break;
case 3:Afficher(noms,n);
break;
case 4:printf("au revoir\n");
break;
default: printf("???\n"); // ???
}
} while (choix != 4); // tant que le choix fait est différent de 4 retour au début
return(0);
}
// Fonction Saisir
int SaisirMot(char mot[10], char noms[10][20])
{
int n,i; // déclaration des variables n et i
printf("Combien de mots voulez vous entrer?\n");
scanf("%d",&n);
for(i=1;i<=n;i++) // boucle for...???
{
printf("entrez un mot\n");
scanf("%s",mot);
strcpy(noms[i-1],mot); // copie de...???
}
return(n);
}
// Fonction afficher
void Afficher (char noms[10][20], int n)
{
int i; // déclaration de i
for(i=0;i<n;i++) // boucle for...???
printf("le mot mot d'indice %d est %s\n",i+1,noms[i]); // ???
}
// Fonction trier
void TrierTab(char noms[][])
{
printf("en construction");
} |
Partager