Accueil > > > MENU ET CONTROLE DE LA SAISIE D'UN ENTIER
MENU ET CONTROLE DE LA SAISIE D'UN ENTIER
Information sur la source
Description
La fonction "short int menu(char*, short int, bool);"
La fonction menu()
Prototype:
short int menu(char *, short int, bool)
entrées:
1er paramatre: pointeur vers 1er element d'un vecteur de char comme suit:
char elemmenu[] = "Titre du menu\0Sortie/retour du menu(0)\01er prop(1)\02eme prop(2)\0etc...\0";
2eme parametre: short int qui donne le choix par défaut.
3eme paramatre: bool, si à vrai affiche les messages d'erreurs en cas d'erreur.
sortie: short int, "-1" en cas d'erreur, "0" en pour la sortie/retour, Si >1 donne le numéro de la proposition.
Utilisation:
Fleche du haut/bas pour changer de propsition (ou raccourci avec le pavé numérique pour les choix de 0 à maximum la 9eme propostion, si il y a)
valider avec la touche [ENTER]
Sortie rapide avec la touche [ESC] (choisi sortie/retour, donc retourne "0")
La fonction "int SaisirEntier(char[]);"
retourne un entier saisie au clavier (controle la saisie)
Source
- /*******************************************************************************\
- * Nom: Thomas * Lieu: Belgique *
- * Pseudo: boygen * Projet: Bibliotheque de fonctions *
- * E-mail: boygen81@hotmail.com* Compilateur: Microsoft Visual C++ (6.0) *
- * Langage:C & C++ * O.S.: Windows 2000 Professionnel *
- * Fichier:fctperso.cpp * Rapport: (voir commentaires) *
- \*******************************************************************************/
-
- /*******************************************************************************
- les definitions des fonctions=
-
- int SaisirEntier(char[]);
- short int menu(char*, short int, bool);
-
- *******************************************************************************/
- // les includes pour toutes les fonctions...
-
- #include <conio.h>
- #include <limits.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <windows.h>
-
-
- /*******************************************************************************/
- // define pour "int SaisirEntier(char[]);"
-
-
-
-
- #define KEY_0 (int) '0' // definition des codes touche
- #define KEY_9 (int) '9'
- #define KEY_ENTER 13
- #define KEY_BKDEL 8
- #define KEY_MOINS (int) '-'
- #define KEY_PLUS (int) '+'
-
-
- /*******************************************************************************/
- // define pour "short int menu(char*, short int, bool);"
-
-
-
-
- #define NBCOLSRC 80
- #define NBLGNSRC 25
-
- #define MENUSELECTED (FOREGROUND_BLUE|FOREGROUND_INTENSITY)
- #define MENUNOSELECTED (FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE)
- #define MENUFORM (FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY)
- #define MENUBK (FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE)
- #define MENUTXT 0
- #define NORMTXT (FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY)
- #define NORMBK 0
- #define ERRORCOLOR (FOREGROUND_RED)
-
-
- #define textattr(color) SetConsoleTextAttribute(STDOUT,color)
- #define textcolor(color) SetConsoleTextAttribute(STDOUT,back_color|(front_color=(color)))
- #define textbackground(color) SetConsoleTextAttribute(STDOUT,(back_color=((color)<<4))|front_color)
- #define HAUT 72
- #define BAS 80
- #define ESC 27
- #define ENTER 13
- #define NUMZERO 48
-
- #define NORM (FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE)
- #define STDOUT GetStdHandle(STD_OUTPUT_HANDLE)
-
- WORD front_color=NORM;
- WORD back_color=0;
-
-
-
- /*******************************************************************************/
- // les fonctions...
- /*******************************************************************************/
- // La fonction "int SaisirEntier(char[]);"
-
-
-
-
-
- int SaisirEntier(char msg[]){
- bool sgplus = false, sgmoins = false, zero = false;
- int entier = 0, keymax;
- char touche;
-
- do{
- system("cls");
-
-
- printf("%s", msg); //affiche la demande
-
- if(sgplus) printf("+"); // gestion de l'affichage des signes
- else if(sgmoins) printf("-");
-
- if(zero) printf("0"); // gestion de l'affichage du zero
- else if(entier) printf("%d",entier); // sinon de l'entier
-
- touche=getch(); // saisie d'un chiffre ou d'une touche commande
-
- if(touche == 0) getch(); // vide le buffer (ex: protection contre les touches etendues)
-
-
-
-
- if(touche == KEY_BKDEL) { //gère la touche d'effacement
- if(!entier) {zero?zero = false :sgmoins = sgplus = false;}
- else entier /= 10;
- }
-
-
- if(!zero){ // gère les touches de signe
- if(!entier && !sgmoins && !sgplus){
- if(touche == KEY_MOINS) sgmoins = true;
- else if(touche == KEY_PLUS) sgplus = true;
- }
-
- if(entier <= (INT_MAX / 10)){ // gere la taille mx de l'entier
- if(touche == KEY_0 && !entier) zero = true;
- else{
- keymax = KEY_9;
- if(entier == (INT_MAX / 10)) keymax = KEY_0 + (INT_MAX % 10);
- if(touche >= KEY_0 && touche <= keymax) entier = (entier * 10) + (touche - KEY_0); // ajoute un chiffre au nombre
- }
- }
-
- }
-
-
- }while(touche != KEY_ENTER || (!entier && !zero)); // condition de sortie
-
- if(sgmoins) entier = -entier; // adapte la valeur en fonction du signe
- return entier; // retourne la valeur
- }
-
-
- /*******************************************************************************/
- // La fonction "short int menu(char*, short int, bool);"
-
- /*
- La fonction menu()
- Prototype:
- short int menu(char *, short int, bool)
- entrées:
- 1er paramatre: pointeur vers 1er element d'un vecteur de char comme suit:
- char elemmenu[] = "Titre du menu\0Sortie/retour du menu(0)\01er prop(1)\02eme prop(2)\0etc...\0";
- 2eme parametre: short int qui donne le choix par défaut.
- 3eme paramatre: bool, si à vrai affiche les messages d'erreurs en cas d'erreur.
-
- sortie: short int, "-1" en cas d'erreur, "0" en pour la sortie/retour, Si >1 donne le numéro de la proposition.
-
- Utilisation:
- Fleche du haut/bas pour changer de propsition (ou raccourci avec le pavé numérique pour les choix de 0 à maximum la 9eme propostion, si il y a)
- valider avec la touche [ENTER]
- Sortie rapide avec la touche [ESC] (choisi sortie/retour, donc retourne "0")
- A faire:
- Géré les caractère spéciaux tel que \t,
- Convertir les saut de ligne de \0 à \n,
- ...
- */
-
-
-
-
-
- void gotoxy(int x,int y){
- COORD pos={x-1,y-1};
- SetConsoleCursorPosition(STDOUT,pos);
- }
-
-
- void procchar(unsigned short int xfois, char cara){
- for(unsigned short int i = 1; i <= xfois; i++) printf("%c", cara);
- }
-
- void writelgn(char *ligne, unsigned short int noprop){
- unsigned short int c = -1;
- for(unsigned short int curprop = 0; curprop < noprop; curprop++) while(*(ligne + (++c)));
- for(unsigned short int i = c+1; *(ligne + i); i++) printf("%c", *(ligne + i));
- }
-
-
-
- short int menu(char *propositions, short int choix, bool prterr){
- unsigned short int nblignes=0, max, lgtitre, curlg=-1, decalage, pavnum, debutlgn;
- short int poiderror = -1, errorcode = 0;
- char touche;
- bool error = false;
-
-
- while(*(propositions + (++curlg)));// donne la longeure du titre
- debutlgn = max = lgtitre = curlg;
-
- while(*(propositions + debutlgn) || *(propositions + debutlgn + 1)){ // donne la ligne la plus grande et compte le nombre de ligne
- curlg = 0;
- while(*(propositions + (debutlgn + (++curlg) + 1)));
- if(curlg > max) max = curlg;
- debutlgn+= (curlg + 1);
- nblignes++;
- }
-
- textcolor(ERRORCOLOR);
- textbackground(NORMBK);
- if(nblignes == 1){
- if(prterr) printf("*** Erreur menu : il faut au moins un titre et un element de fin ***\n");
- errorcode += poiderror;
- }
- poiderror *= 2;
-
- if((nblignes* 2 + 6) > NBLGNSRC){
- if(prterr) printf("*** Erreur menu : trop de proposition pour l'ecran ***\n");
- errorcode += poiderror;
- }
- poiderror *= 2;
-
- if((max + 5) > NBCOLSRC){
- if(prterr) printf("*** Erreur menu : proposition(s) trop longue(s) ***\n");
- errorcode += poiderror;
- }
- poiderror *= 2;
-
- if(choix < 0 || choix >= nblignes){
- if(prterr) printf("*** Erreur menu : choix par defaut hors des possibilitees ***\n");
- errorcode += poiderror;
- }
-
-
- if(errorcode) return errorcode;
- else{
-
- decalage = (NBCOLSRC - (max + 4))/2;
-
- system("cls");// efface l'ecran
-
-
- // dessinne le tableau
- textbackground(NORMBK);
- procchar(decalage, ' ');
- textcolor(MENUTXT);textbackground(MENUFORM);
- printf("ÉÍ");
- procchar(max, 'Í');
- printf("Í»\n");
-
- textbackground(NORMBK);
- procchar(decalage, ' ');
- textcolor(MENUTXT);textbackground(MENUFORM);
- printf("º");
- procchar((max-lgtitre)/2, ' ');
- printf("Ú");
- procchar(lgtitre, 'Ä');
- printf("¿");
- procchar((max-lgtitre)/2 + (max-lgtitre)%2, ' ');
- printf("º");
- textbackground(MENUBK);printf(" \n");textbackground(MENUFORM);
-
- textbackground(NORMBK);
- procchar(decalage, ' ');
- textcolor(MENUTXT);textbackground(MENUFORM);
- printf("º");
- procchar((max-lgtitre)/2, ' ');
- textcolor(MENUTXT);textbackground(MENUFORM);
- printf("³");
-
-
- writelgn(propositions, 0); // affichage du titre
-
- printf("³");
- procchar((max-lgtitre)/2 + (max-lgtitre)%2, ' ');
- printf("º");
- textbackground(MENUBK);printf(" \n");textbackground(MENUFORM);
-
- textbackground(NORMBK);
- procchar(decalage, ' ');
-
- textcolor(MENUTXT);textbackground(MENUFORM);
- printf("º");
- procchar((max-lgtitre)/2, ' ');
- textcolor(MENUTXT);textbackground(MENUFORM);
- printf("À");
- procchar(lgtitre, 'Ä');
- printf("Ù");
- procchar((max-lgtitre)/2 + (max-lgtitre)%2, ' ');
- printf("º");
- textbackground(MENUBK);printf(" \n");textbackground(MENUFORM);
-
- for(int i = 1; i <= (nblignes * 2)+1; i++){ // pas i<= nblignes car il y a le titre
- textbackground(NORMBK);
- procchar(decalage, ' ');
- textcolor(MENUTXT);textbackground(MENUFORM);
- printf("º ");
- procchar(max, ' ');
- textcolor(MENUTXT);textbackground(MENUFORM);
- printf(" º");
- textbackground(MENUBK);printf(" \n");textbackground(MENUFORM);
- }
-
- textbackground(NORMBK);
- procchar(decalage, ' ');
- textcolor(MENUTXT);textbackground(MENUFORM);
- printf("ÈÍ");
- procchar(max, 'Í');
- printf("ÍO");
- textbackground(MENUBK);printf(" \n");textbackground(MENUFORM);
-
- textbackground(NORMBK);
- procchar(decalage+1, ' ');
- textbackground(MENUBK);procchar(max+4, ' ');
-
- textbackground(MENUFORM);
- do{
- for(int i = 2; i <= nblignes; i++){
- if (choix == (i-1)) textcolor(MENUSELECTED);
- else textcolor(MENUNOSELECTED);
- gotoxy(decalage+3,4+2*(i-1));
- writelgn(propositions, i); // affichage des propostitions
- }
-
- if (choix == 0) textcolor(MENUSELECTED);
- else textcolor(MENUNOSELECTED);;
- gotoxy(decalage+3,4+2*nblignes);
- writelgn(propositions, 1); // affichage de la proposition de sortie
-
- touche=getch();
-
- if(choix == 0) choix = nblignes;
- if(touche == BAS) choix = ++choix;
- if(touche == HAUT) choix = --choix;
- if(touche == ESC) choix = 0;
-
- if(nblignes > 10) pavnum = 10;
- else pavnum = nblignes;
- if (touche >= NUMZERO && touche < (NUMZERO + pavnum)) choix = touche - NUMZERO;
-
- choix %= nblignes;
-
-
- }while (touche!=ENTER && touche!=ESC);
- textcolor(NORMTXT);textbackground(NORMBK);gotoxy(1,1);system("cls"); // retour à un ecran vierge
- return choix;
-
- }
-
- }
-
-
- void main(void){
-
- int choix=2, a;
-
- do{
- switch(choix = menu("DEMO\0Quitter la demo\0Saisir un entier\0choix par defaut\0choix 3\0", choix, false)){
- case 1: a = SaisirEntier("Entrer un entier:"); printf("\nVoici l'entier: %d\n", a);
- break;
- case 2: printf("Choix par defaut\n");
- break;
- case 3: printf("Choix 3\n");
- }
- system("pause");
- }while(choix);
-
- }
/*******************************************************************************\
* Nom: Thomas * Lieu: Belgique *
* Pseudo: boygen * Projet: Bibliotheque de fonctions *
* E-mail: boygen81@hotmail.com* Compilateur: Microsoft Visual C++ (6.0) *
* Langage:C & C++ * O.S.: Windows 2000 Professionnel *
* Fichier:fctperso.cpp * Rapport: (voir commentaires) *
\*******************************************************************************/
/*******************************************************************************
les definitions des fonctions=
int SaisirEntier(char[]);
short int menu(char*, short int, bool);
*******************************************************************************/
// les includes pour toutes les fonctions...
#include <conio.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
/*******************************************************************************/
// define pour "int SaisirEntier(char[]);"
#define KEY_0 (int) '0' // definition des codes touche
#define KEY_9 (int) '9'
#define KEY_ENTER 13
#define KEY_BKDEL 8
#define KEY_MOINS (int) '-'
#define KEY_PLUS (int) '+'
/*******************************************************************************/
// define pour "short int menu(char*, short int, bool);"
#define NBCOLSRC 80
#define NBLGNSRC 25
#define MENUSELECTED (FOREGROUND_BLUE|FOREGROUND_INTENSITY)
#define MENUNOSELECTED (FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE)
#define MENUFORM (FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY)
#define MENUBK (FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE)
#define MENUTXT 0
#define NORMTXT (FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY)
#define NORMBK 0
#define ERRORCOLOR (FOREGROUND_RED)
#define textattr(color) SetConsoleTextAttribute(STDOUT,color)
#define textcolor(color) SetConsoleTextAttribute(STDOUT,back_color|(front_color=(color)))
#define textbackground(color) SetConsoleTextAttribute(STDOUT,(back_color=((color)<<4))|front_color)
#define HAUT 72
#define BAS 80
#define ESC 27
#define ENTER 13
#define NUMZERO 48
#define NORM (FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE)
#define STDOUT GetStdHandle(STD_OUTPUT_HANDLE)
WORD front_color=NORM;
WORD back_color=0;
/*******************************************************************************/
// les fonctions...
/*******************************************************************************/
// La fonction "int SaisirEntier(char[]);"
int SaisirEntier(char msg[]){
bool sgplus = false, sgmoins = false, zero = false;
int entier = 0, keymax;
char touche;
do{
system("cls");
printf("%s", msg); //affiche la demande
if(sgplus) printf("+"); // gestion de l'affichage des signes
else if(sgmoins) printf("-");
if(zero) printf("0"); // gestion de l'affichage du zero
else if(entier) printf("%d",entier); // sinon de l'entier
touche=getch(); // saisie d'un chiffre ou d'une touche commande
if(touche == 0) getch(); // vide le buffer (ex: protection contre les touches etendues)
if(touche == KEY_BKDEL) { //gère la touche d'effacement
if(!entier) {zero?zero = false :sgmoins = sgplus = false;}
else entier /= 10;
}
if(!zero){ // gère les touches de signe
if(!entier && !sgmoins && !sgplus){
if(touche == KEY_MOINS) sgmoins = true;
else if(touche == KEY_PLUS) sgplus = true;
}
if(entier <= (INT_MAX / 10)){ // gere la taille mx de l'entier
if(touche == KEY_0 && !entier) zero = true;
else{
keymax = KEY_9;
if(entier == (INT_MAX / 10)) keymax = KEY_0 + (INT_MAX % 10);
if(touche >= KEY_0 && touche <= keymax) entier = (entier * 10) + (touche - KEY_0); // ajoute un chiffre au nombre
}
}
}
}while(touche != KEY_ENTER || (!entier && !zero)); // condition de sortie
if(sgmoins) entier = -entier; // adapte la valeur en fonction du signe
return entier; // retourne la valeur
}
/*******************************************************************************/
// La fonction "short int menu(char*, short int, bool);"
/*
La fonction menu()
Prototype:
short int menu(char *, short int, bool)
entrées:
1er paramatre: pointeur vers 1er element d'un vecteur de char comme suit:
char elemmenu[] = "Titre du menu\0Sortie/retour du menu(0)\01er prop(1)\02eme prop(2)\0etc...\0";
2eme parametre: short int qui donne le choix par défaut.
3eme paramatre: bool, si à vrai affiche les messages d'erreurs en cas d'erreur.
sortie: short int, "-1" en cas d'erreur, "0" en pour la sortie/retour, Si >1 donne le numéro de la proposition.
Utilisation:
Fleche du haut/bas pour changer de propsition (ou raccourci avec le pavé numérique pour les choix de 0 à maximum la 9eme propostion, si il y a)
valider avec la touche [ENTER]
Sortie rapide avec la touche [ESC] (choisi sortie/retour, donc retourne "0")
A faire:
Géré les caractère spéciaux tel que \t,
Convertir les saut de ligne de \0 à \n,
...
*/
void gotoxy(int x,int y){
COORD pos={x-1,y-1};
SetConsoleCursorPosition(STDOUT,pos);
}
void procchar(unsigned short int xfois, char cara){
for(unsigned short int i = 1; i <= xfois; i++) printf("%c", cara);
}
void writelgn(char *ligne, unsigned short int noprop){
unsigned short int c = -1;
for(unsigned short int curprop = 0; curprop < noprop; curprop++) while(*(ligne + (++c)));
for(unsigned short int i = c+1; *(ligne + i); i++) printf("%c", *(ligne + i));
}
short int menu(char *propositions, short int choix, bool prterr){
unsigned short int nblignes=0, max, lgtitre, curlg=-1, decalage, pavnum, debutlgn;
short int poiderror = -1, errorcode = 0;
char touche;
bool error = false;
while(*(propositions + (++curlg)));// donne la longeure du titre
debutlgn = max = lgtitre = curlg;
while(*(propositions + debutlgn) || *(propositions + debutlgn + 1)){ // donne la ligne la plus grande et compte le nombre de ligne
curlg = 0;
while(*(propositions + (debutlgn + (++curlg) + 1)));
if(curlg > max) max = curlg;
debutlgn+= (curlg + 1);
nblignes++;
}
textcolor(ERRORCOLOR);
textbackground(NORMBK);
if(nblignes == 1){
if(prterr) printf("*** Erreur menu : il faut au moins un titre et un element de fin ***\n");
errorcode += poiderror;
}
poiderror *= 2;
if((nblignes* 2 + 6) > NBLGNSRC){
if(prterr) printf("*** Erreur menu : trop de proposition pour l'ecran ***\n");
errorcode += poiderror;
}
poiderror *= 2;
if((max + 5) > NBCOLSRC){
if(prterr) printf("*** Erreur menu : proposition(s) trop longue(s) ***\n");
errorcode += poiderror;
}
poiderror *= 2;
if(choix < 0 || choix >= nblignes){
if(prterr) printf("*** Erreur menu : choix par defaut hors des possibilitees ***\n");
errorcode += poiderror;
}
if(errorcode) return errorcode;
else{
decalage = (NBCOLSRC - (max + 4))/2;
system("cls");// efface l'ecran
// dessinne le tableau
textbackground(NORMBK);
procchar(decalage, ' ');
textcolor(MENUTXT);textbackground(MENUFORM);
printf("ÉÍ");
procchar(max, 'Í');
printf("Í»\n");
textbackground(NORMBK);
procchar(decalage, ' ');
textcolor(MENUTXT);textbackground(MENUFORM);
printf("º");
procchar((max-lgtitre)/2, ' ');
printf("Ú");
procchar(lgtitre, 'Ä');
printf("¿");
procchar((max-lgtitre)/2 + (max-lgtitre)%2, ' ');
printf("º");
textbackground(MENUBK);printf(" \n");textbackground(MENUFORM);
textbackground(NORMBK);
procchar(decalage, ' ');
textcolor(MENUTXT);textbackground(MENUFORM);
printf("º");
procchar((max-lgtitre)/2, ' ');
textcolor(MENUTXT);textbackground(MENUFORM);
printf("³");
writelgn(propositions, 0); // affichage du titre
printf("³");
procchar((max-lgtitre)/2 + (max-lgtitre)%2, ' ');
printf("º");
textbackground(MENUBK);printf(" \n");textbackground(MENUFORM);
textbackground(NORMBK);
procchar(decalage, ' ');
textcolor(MENUTXT);textbackground(MENUFORM);
printf("º");
procchar((max-lgtitre)/2, ' ');
textcolor(MENUTXT);textbackground(MENUFORM);
printf("À");
procchar(lgtitre, 'Ä');
printf("Ù");
procchar((max-lgtitre)/2 + (max-lgtitre)%2, ' ');
printf("º");
textbackground(MENUBK);printf(" \n");textbackground(MENUFORM);
for(int i = 1; i <= (nblignes * 2)+1; i++){ // pas i<= nblignes car il y a le titre
textbackground(NORMBK);
procchar(decalage, ' ');
textcolor(MENUTXT);textbackground(MENUFORM);
printf("º ");
procchar(max, ' ');
textcolor(MENUTXT);textbackground(MENUFORM);
printf(" º");
textbackground(MENUBK);printf(" \n");textbackground(MENUFORM);
}
textbackground(NORMBK);
procchar(decalage, ' ');
textcolor(MENUTXT);textbackground(MENUFORM);
printf("ÈÍ");
procchar(max, 'Í');
printf("ÍO");
textbackground(MENUBK);printf(" \n");textbackground(MENUFORM);
textbackground(NORMBK);
procchar(decalage+1, ' ');
textbackground(MENUBK);procchar(max+4, ' ');
textbackground(MENUFORM);
do{
for(int i = 2; i <= nblignes; i++){
if (choix == (i-1)) textcolor(MENUSELECTED);
else textcolor(MENUNOSELECTED);
gotoxy(decalage+3,4+2*(i-1));
writelgn(propositions, i); // affichage des propostitions
}
if (choix == 0) textcolor(MENUSELECTED);
else textcolor(MENUNOSELECTED);;
gotoxy(decalage+3,4+2*nblignes);
writelgn(propositions, 1); // affichage de la proposition de sortie
touche=getch();
if(choix == 0) choix = nblignes;
if(touche == BAS) choix = ++choix;
if(touche == HAUT) choix = --choix;
if(touche == ESC) choix = 0;
if(nblignes > 10) pavnum = 10;
else pavnum = nblignes;
if (touche >= NUMZERO && touche < (NUMZERO + pavnum)) choix = touche - NUMZERO;
choix %= nblignes;
}while (touche!=ENTER && touche!=ESC);
textcolor(NORMTXT);textbackground(NORMBK);gotoxy(1,1);system("cls"); // retour à un ecran vierge
return choix;
}
}
void main(void){
int choix=2, a;
do{
switch(choix = menu("DEMO\0Quitter la demo\0Saisir un entier\0choix par defaut\0choix 3\0", choix, false)){
case 1: a = SaisirEntier("Entrer un entier:"); printf("\nVoici l'entier: %d\n", a);
break;
case 2: printf("Choix par defaut\n");
break;
case 3: printf("Choix 3\n");
}
system("pause");
}while(choix);
}
Conclusion
A faire (pour le menu):
Géré les caractère spéciaux tel que \t,
Convertir les saut de ligne de \0 à \n,
...
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
IMAGINE CUP 2012, MAKE A SIGN EN FINALEIMAGINE CUP 2012, MAKE A SIGN EN FINALE par junarnoalg
Voilà qui est fait, la nouvelle est officielle ! L'équipe belge "Make a Sign" va au pays des kangourous défendre son projet dans la catégorie Software Design. http://www.imaginecup.com/CompetitionsContent/Competition/WorldwideFinalists.aspx V...
Cliquez pour lire la suite de l'article par junarnoalg KINECT 1.5 IS OUT !KINECT 1.5 IS OUT ! par Vko
La version 1.5 du Kinect For Microsoft vient tout juste de sortir ! Plein de nouveautés: Tracking de squelette en Near Mode Détection en position assise Détection faciale avec un SDK dédié Documentation et des guideline (enfin) Un out...
Cliquez pour lire la suite de l'article par Vko LES ACTUALITéS DE LA SEMAINE SUR C2I.FR (14 MAI - 20 MAI) LES ACTUALITéS DE LA SEMAINE SUR C2I.FR (14 MAI - 20 MAI) par richardc
Mise à jour des Web API du 14 Mai
Réservez dès maintenant votre journée du 20 juin pour le Windows Azure Dev Camp 2012 à Paris
Mise à jour de Team Foundation Service
MechCommander 2 sur Windows 8
Entity Framework 5 Release Candidate e...
Cliquez pour lire la suite de l'article par richardc REACTIVE EXTENSIONS : CONSOMMER DES SERVICES AVEC RX PARTIE 3, LES PIèGES à éVITERREACTIVE EXTENSIONS : CONSOMMER DES SERVICES AVEC RX PARTIE 3, LES PIèGES à éVITER par Groc
Une mauvaise utilisation de rx lors de l'écriture d'une couche d'accès à des services peut conduire à des cas embarassants avec des erreurs mal gérées, des appels qui ne partent lorsqu'ils le devraient, et même des résultats incorrects . le tout nuis...
Cliquez pour lire la suite de l'article par Groc SHAREPOINT BLOG SITE, PROBLèME D'ARCHIVESSHAREPOINT BLOG SITE, PROBLèME D'ARCHIVES par junarnoalg
Dernièrement, nous avons migré le site
myTIC
vers un nouveau serveur SharePoint 2010. Dans les contenus que nous vouloins récupérer, nous avions un certain nombre de blogs.
Nous avons utilisé les commandes Power...
Cliquez pour lire la suite de l'article par junarnoalg
Forum
MATRICE TEMPLATEMATRICE TEMPLATE par hjr2610
Cliquez pour lire la suite par hjr2610 RE : SAC A DOS RE : SAC A DOS par hadjkaddour
Cliquez pour lire la suite par hadjkaddour
Logiciels
sDEVIS-FACTURES vlPRO (8.1.0.3)SDEVIS-FACTURES VLPRO (8.1.0.3)sDEVIS-FACTURES vlPRO a été mis au point pour les particuliers, créateurs, entrepreneurs, artisa... Cliquez pour télécharger sDEVIS-FACTURES vlPRO 974 Application Server (12.2.4.6)974 APPLICATION SERVER (12.2.4.6)Développez de puissantes applications dans un environnement de 'cloud computing', clusterisé, séc... Cliquez pour télécharger 974 Application Server vPicture (1.4.2.1)VPICTURE (1.4.2.1)Avec vPicture, hébergez vos images facilement et rapidement.
vPicture est un utilitaire simple, ... Cliquez pour télécharger vPicture Easy-Planning (2.2.1.6)EASY-PLANNING (2.2.1.6)Easy-Planning permet de créer des plannings sous la représentation de diagrammes et est adapté au... Cliquez pour télécharger Easy-Planning COM-BACKUP (2.0)COM-BACKUP (2.0)
COM-BACKUP est un logiciel de sauvegarde qui permet de planifier les sauvegardes de vos dossiers ...
Cliquez pour télécharger COM-BACKUP
|