procedure afficherFichier(E f:Fichier) { variable c : caractère Decaler(f,Debut_Fichier, 0) Tantque (NON (Fin(f))) { Lire(f,c) Afficher(c) } } procedure copierFichier(E f:Fichier) { variable c : caractère nom : chaine f2 : Fichier Affichier("Veuillez saisir le nom ") Saisir(nom) Creer(nom, f2) Ouvrir(f2, Ecriture) Decaler(f,Debut_Fichier, 0) Tantque (NON (Fin(f))) { Lire(f,c) Ecrire(f2,c) } Fermer(f2) } procedure analyserFichier(E f: Fichier) { variable c : caractere nb, nbv, nbl, nbc : entier Decaler(f, Debut_Fichier, 0) nb <-- 0 nbv <-- 0 nbc <-- 0 nbl <-- 0 Tantque(NON (Fin(f))) { Lire(f,c) nb <-- nb +1 Si ((c ='a') OU (c='e') OU (c='i') OU (c='o') OU (c='u') OU (c='y') OU (c ='A') OU (c='E') OU (c='I') OU (c='O') OU (c='U') OU (c='Y')) alors nbv <-- nbv + 1 sinon { Si (c = '\n') alors { nbl <-- nbl +1 } sinon { Si ((c='0') OU (c='1') OU (c='2') OU (c='3') OU (c='4') OU (c='5') OU (c='6') OU (c='7') OU (c='8') OU (c='9')) alors { nbc <-- nbc+1 } } } } Afficher("Le nombre de caractères dans le fichier est :", nb, ".\n") Afficher("Le nombre de lignes dans le fichier est :", nbl+1, ".\n") Afficher("Le nombre de voyelles dans le fichier est :", nbv, ".\n") Afficher("Le nombre de chiffres dans le fichier est :", nbc, ".\n") } procedure afficherLigne10Max(E f: Fichier) { variable c: caractere nbc : entier nbc <-- 0 Decaler(f, Debut_Fichier, 0) Tantque(NON Fin(f)) { Lire(f,c) Afficher(c) Si (c='\n') alors { nbc <-- 0 } else { nbc <-- nbc + 1 si (nbc = 10) alors { Afficher('\n') nbc <-- 0 } } } } fonction palindrome(E mot : chaine, E taille : entier) : booleen { variable g, d : entier g <-- 0 d <-- taille - 1 Tantque ((g=d) alors { retourner VRAI } sinon { retourner FAUX } } procedure analyserFichier2(E f: Fichier) { variable c : caractère nbmot, nbpal, taillemot : entier dansunmot : booleen mot : chaine nbmot <-- 0 nbpal <-- 0 taillemot <-- 0 dansunmot <-- FAUX Decaler(f, Debut_Fichier,0) Tantque(NON(Fin(f))) { Lire(f,c) Si (c=' ' OU c='\t' OU c='\n' OU c='.' OU c=';' OU c=':' OU c='-' OU ...) alors { Si (dansunmot) alors { nbmot <-- nbmot + 1 Si (palindrome(mot, taillemot)) alors nbpal <-- nbpal + 1 dansunmot <-- FAUX taillemot <-- 0 } } sinon { dansunmot <-- VRAI mot[taillemot] <-- c taillemot <-- taillemot + 1 } } Afficher("Le nomnbre total de mots dans le fichier est : ", nbmot,".\n") Afficher("Le nomnbre total de palindromes dans le fichier est : ", nbpal,".\n") } Algorithme Menu { variable f: Fichier nom : chaine reponse : entier Afficher("Saisir le nom du fichier") Saisir(nom) Designer(nom,f) Ouvrir(f,Lecture) Repeter { Afficher("0:Sortir\n") Afficher("1:Afficher\n") Afficher("2:Copier\n") Afficher("3:Analyser\n") Afficher("4:Afficher par ligne\n") Selon (reponse) { 1 : afficherFichier(f) 2 : copierFichier(f) 3 : analyserFichier(f) 4 : AfficherFichierLigne10Max(f) } } jusqu'à (reponse = 0) }