Advertisement
Guest User

TP7_exo4

a guest
Nov 26th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.80 KB | None | 0 0
  1. /*
  2.  * exo4.c
  3.  *
  4.  *  Created on: 26 nov. 2015
  5.  *      Author: omarou
  6.  */
  7.  
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11.  
  12. #define NBC 6
  13. #define NBM 20
  14.  
  15. void SaisieVerbe (char tab[],int *nb){
  16.     do {
  17.         printf("Entrée : ");
  18.         scanf("%s",tab);
  19.         *nb=strlen(tab);
  20.     } while (tab[*nb-2]!='e' && tab[*nb-1]!='r');
  21. }
  22.  
  23. void Conjug (char tab[],int nb,char *tabterm[],char *tabsuj[]) {
  24.     int i;
  25.     for(i=0;i<NBC;i++) {
  26.         int j;
  27.         printf("%s",tabsuj[i]);
  28.         for(j=0;j<nb-2;j++) printf("%c",tab[j]);
  29.         printf("%s\n\t",tabterm[i]);
  30.     }
  31. }
  32. int main(){
  33.     char *tabterm[] = {"e","es","e","ons","ez","ent"};
  34.     char *tabsuj[] = {"Je","Tu","Il","Nous","Vous","Ils"};
  35.     char tab[NBM];
  36.     int nb;
  37.     SaisieVerbe(tab,&nb);
  38.     printf("Sortie : ");
  39.     Conjug(tab,nb,tabterm,tabsuj);
  40.     return EXIT_SUCCESS;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement