'ai voulu commence à apprendre a programmer en langage C j'ai commence il y a deux jours.je réponds: "Commence par le début alors!"
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question#include <stdio.h> int main(void) { char prenom[32] = {0}; int jour = 0; int mois = 0; int annee = 0; int got = 0; got = scanf("%d %d %d", &jour, &mois, &annee); /* Si got < 0 alors erreur avec scanf, je ne le gère pas ici pour simplifier. Voir la doc de scanf. */ if (got == 3) { printf("Vous etes donc nes le %d %d %d\n", jour, mois, annee); return 0; } got = scanf("%s", prenom); if (got == 1) { printf("Vous vous appelez donc %s\n", prenom); return 0; } printf("Impossible de recuperer une entree !\n"); return 1; }
Améliorez votre expérience CodeS-SourceS avec ce plugin:
http://codes-sources.commentcamarche.net/forum/affich-10000111-plugin-better-cs-2#cptpingu-signature
void menu(){
printf("menu\n-------\n");
printf("1:Choisir un prenom\n");
printf("2:Choisir une date\n");
printf("3: sortie\n");
}
int main()
{
int choix, fin=1, prenom, date;
menu();
while(fin){
printf("quel est votre choix : \n");
scanf("%d", &choix);
switch(choix){
case 1: {prenom; printf("vous avez donc choisis prenom\n", prenom);} break;
case 2: {date; printf("vous avez donc choisis une datee\n", date);} break;
case 3: return 0;break;
default : {printf("ce choix n'existe pas ! \n");}
}
}
}
#include <stdio.h> int menu(void) { int choix = 0; printf("menu\n-------\n" "1: Choisir un prenom\n" "2: Choisir une date\n" "3: Sortie\n" "Quel est votre choix:\n"); scanf("%d", &choix); return choix; } int main(void) { int fin = 1; char prenom[32] = {0}; int date = 0; while (fin) { switch (menu()) { case 1: scanf("%s", prenom); printf("vous avez donc choisis %s\n", prenom); break; case 2: scanf("%d", date); printf("Vous avez donc choisis une date %d\n", date); break; case 3: fin = 0; break; default: printf("Ce choix n'existe pas ! \n"); } } return 0; }
Améliorez votre expérience CodeS-SourceS avec ce plugin:
http://codes-sources.commentcamarche.net/forum/affich-10000111-plugin-better-cs-2#cptpingu-signature
Améliorez votre expérience CodeS-SourceS avec ce plugin:
http://codes-sources.commentcamarche.net/forum/affich-10000111-plugin-better-cs-2#cptpingu-signature