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<stdlib.h>
#include<stdio.h>
#include<string.h>
#define NB_MAX_CARACT 25
char *saisir_le_mot_a_trouver();
char *initialiser_la_reponse(char *mot, int longueur);
int main(){
char mot[] = "developpez.com";
char reponse[NB_MAX_CARACT +1];
int longueur = strlen(mot);
strcpy(reponse, initialiser_la_reponse(mot,longueur));
system("PAUSE");
return 0;
}
char *initialiser_la_reponse(char *mot,int longueur){
int i=0;
char reponse[NB_MAX_CARACT +1];
char dern_lettre[] = {mot[longueur-1],'\0'};
reponse[0] = mot[0];
strncat(reponse, "-------------------------------", longueur-2);
reponse[longueur-1] = mot[longueur-1];
printf("%s\n\n",reponse);
return(reponse);
} |
Partager