Programme C défile sans s'arrêter
Résolu/Fermé
A voir également:
- Programme C défile sans s'arrêter
- Programme demarrage windows 10 - Guide
- Programme démarrage windows 10 - Guide
- Fichier ouvert dans un autre programme - Guide
- Desinstaller un programme - Guide
- Programme bonjour c'est quoi ✓ - Forum Logiciels
2 réponses
varfendell
Messages postés
3256
Date d'inscription
jeudi 27 décembre 2007
Statut
Membre
Dernière intervention
8 février 2020
699
28 juil. 2010 à 13:40
28 juil. 2010 à 13:40
Bonjour,
Deja remplacer
<code#include <stdio.h>
#include <stdlib.h>
#define QUIT 3
int choix_menu(void);
void affiche(void);
int main()
{
int choix = 0;
while(choix != QUIT)
{
choix = choix_menu();
if(choix == 1)
printf("\nL'ordinateur va biper \a\a\a");
else
{
if(choix == 2)
affiche();
}
}
printf("Vous avez choisi de sortir!\n");
system("pause");
exit(EXIT_FAILURE);
}
int choix_menu(void)
{
int selection = 0;
do
{
printf("\n");
printf("\n1 - Bip ordinateur");
printf("\n2 - Affichage");
printf("\n3 - Sortir");
printf("\n");
printf("\nEntrez votre choix :");
scanf("&d", &selection); ===> scanf("%d", &selection);
}while (selection < 1 || selection > 3);
return selection;
}
void affiche(void)
{
printf("\nExemple d'affichage");
printf("\n\nOrdre\tSignification");
printf("\n======\t==============");
printf("\n\\a\tsonnerie ");
printf("\n\\b\tretour arriere");
printf("\n...\t\t...");
} </code>
Deja remplacer
<code#include <stdio.h>
#include <stdlib.h>
#define QUIT 3
int choix_menu(void);
void affiche(void);
int main()
{
int choix = 0;
while(choix != QUIT)
{
choix = choix_menu();
if(choix == 1)
printf("\nL'ordinateur va biper \a\a\a");
else
{
if(choix == 2)
affiche();
}
}
printf("Vous avez choisi de sortir!\n");
system("pause");
exit(EXIT_FAILURE);
}
int choix_menu(void)
{
int selection = 0;
do
{
printf("\n");
printf("\n1 - Bip ordinateur");
printf("\n2 - Affichage");
printf("\n3 - Sortir");
printf("\n");
printf("\nEntrez votre choix :");
scanf("&d", &selection); ===> scanf("%d", &selection);
}while (selection < 1 || selection > 3);
return selection;
}
void affiche(void)
{
printf("\nExemple d'affichage");
printf("\n\nOrdre\tSignification");
printf("\n======\t==============");
printf("\n\\a\tsonnerie ");
printf("\n\\b\tretour arriere");
printf("\n...\t\t...");
} </code>