Bonjour,
Je fais un petit exercice de saisie de chaine et de glissement de tableau.
Le programme se compil sans problème, mais lors de l'exécution, il n'exécute pas la fonction GETS.
Il va directement à la fin ...
Et donc, le printf "Phrase introduite : %s" ne donne rien
Compilateur: Code::Blocks
Source C:
Merci à vous
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 #include <stdio.h> #include <ctype.h> #include <string.h> #define LEN 80 int main(void){ char tab_phrase_introduite[LEN] = "\0"; char tab_phrase_cryptee[LEN] = "\0"; char choix; printf("Cryptage d une phrase \n"); printf("===================== \n"); printf("Choisissez le type de cryptage: \n"); printf("[A]uguste,[H]elene,[C]esar,a[V]ocat,[R]ot13,h[E]rge "); scanf("%c", &choix); printf("\n"); printf("choix = %c\n", choix); choix = toupper(choix); printf("choix = %c\n", choix); printf("Phrase a crypter : "); gets(tab_phrase_introduite); printf("\n"); printf("Phrase introduite : %s\n", tab_phrase_introduite); return 0; }
Thomas![]()
Partager