procedure afficherFichier (E f:Fichier) { variable c : caractere Decaler(f, Debut_Fichier, 0) Tant que (NON ( Fin(f))) { Lire(f, c) Afficher(c) } } Procedure copierFichier(E f: Fichier) { variable nom : chaine f2 : Fichier c : caractere Afficher("Saisir le nom du fichier") Saisir(nom) Creer(nom, f2) Ouvrir(f2, Ecriture) Decaler(f, Debut_Fichier, 0) Tant que (NON ( Fin(f))) { Lire(f, c) Ecrire(f2, c) } Fermer(f2) } procedure analyserFichier(E f: Fichier) { variable c : caractère nbc, nbch, nbv, nbl : entier nbc <-- 0 nbv <-- 0 nbch <-- 0 nbl <-- 0 Decaler(f, Debut_Fichier, 0) Tantque (Non (Fin (f))) { Lire(f,c) nbc <-- nbc + 1 Si (c='a' OU c = 'A' OU c='e' OU c = 'E' OU c='i' OU c = 'I' OU c='o' OU c = 'O' OU c='u' OU c = 'U' OU c='y' OU c = 'Y') alors nbv <-- nbv +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 nbch <-- nbch +1 sinon Si (c='\n') alors nbl <-- nbl+1 } Afficher("Le nomnbre total de caractères dans le fichier est : ", nbc,".\n") Afficher("Le nomnbre total de voyelles dans le fichier est : ", nbv,".\n") Afficher("Le nomnbre total de chiffres dans le fichier est : ", nbch,".\n") Afficher("Le nomnbre total de lignes dans le fichier est : ", nb,".\n") } procedure afficherFichierLigne10max(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 sinon { 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) ET (mot[g]=mot[d])) { g <-- g +1 d <-- d -1 } Si (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 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") Saisir(reponse) Selon (reponse) { 1: afficherFichier(f) 2: copierFichier(f) 3: analyserFichier(f) 4: afficherFichierLigne10max(f) } jusqu'à (reponse = 0) Fermer(f) }