Application sous forme d'un menu
Bonjour
Est ce que quelqu'un peut m'aider ....
présenter l'application sous forme d'un menu:
****************************************
* MENU PRINCIPAL *
****************************************
* a- construire un alphabet. *
* b- Afficher l'alphabet. *
* c- Tester si une chaine est un mot *
* d- Longueur d'un mot *
* e- Tester l'egalite de deux mots *
* f- Concatener deux mots *
* g- Calculer la puissane d'un mot *
* h- Construire la miroir d'un mot *
* i- Tester si un mot est vide *
* j- Tester si un mot est un prefixe *
* k- Tester si un mot est un suffixe *
* l- Tester si un mot est un facteur *
* m- Tester si un mot est un sous-mot *
* n- calculer les prefixes d'un mot *
* o- calculer les suffixes d'un mot *
* p- calculer les facteurs d'un mot *
* q- tester si un mot est un palindrome*
* r- chercher un mot dans un fichier *
* s- arreter l'application *
****************************************
tapez votre choix[a.....s]
et merciiii:cry:
Menu en c .. pas d'arret avec l'appel getchar()..
Bonjour, voic mon code , je cherche un coup de main pour arriver à faire des arrets après le printf avant de revenir au menu principal: j'ai utilisé getchar() mais ca s'arrete pas après le text"Appuyez sur Entrer pour retourner au menu principal"
Code:
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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
#include "Arbin1.h"
#include <stdio.h>
#include <stdlib.h>
//Le menu
int menu()
{
int choix;
do
{
system("clear"); //efface l'écran
printf("**********Arbre binaire************\n");
/***************Dessiner mon arbre binaire***********************/
printf(" 1 \n");
printf(" / \\ \n");
printf(" 2 3 \n");
printf(" / \\ / \\ \n");
printf(" 4 5 6 7 \n");
printf(" / \\ \n");
printf(" 8 9 \n");
printf(" / \n");
printf(" 10 \n");
/**************************************************************/
printf(" --------------------------------------------------------\n");
printf(" \n");
printf(" Menu Principal º\n");
printf(" \n");
printf(" ---------------------------------------------------------\n");
printf("\n 1- Affichage infixe");
printf("\n 2- ");
printf("\n 3- ");
printf("\n 4- Quitter\n");
printf("\n\nChoix :");
scanf("%d",&choix);
}
while (choix <1 || choix >4);
system("clear");
return choix;
}
void main (void)
{
int choix;
choix=menu();
int b;
int c;
Arbin a =lam();// arbre vide
/*********** creer arbre binaire ********************/
a= e(
e( e(lam(), 4, lam()),
2,
e( e(e(lam(), 10, lam()), 8, lam()),5,e(lam(), 9, lam()))),
1,
e(e(lam(), 6, lam()),3,e(lam(), 7, lam())
));
/******************************************************/
while(choix!=4)
{
switch (choix) {
case 1:
infixe_rec(a, ecricar);
printf("\n\nAppuyez sur Entrer pour retourner au menu principal");
// faire un arret..
while (getchar()!='\n');
choix=menu();
break;
case 2:
printf("Erreur de saisie\n");
printf("\n\nAppuyez sur Entrer pour retourner au menu principal");
// faire un arret..
while (getchar()!='\n');
break;
}
...
choix=menu();
}} |
merci d'avance