1 / 18

Informatique Cours 9 12/11/2001

Informatique Cours 9 12/11/2001. Algorithmique et programmation. Les caractères. Ensemble ordonné Codage ASCII ( 7 bits: 2 7 = 128 codes ) American Standard Code for Information Interchange ASCII étendu ( 8 bits ) ISO latin-1 UNICODE ( 2 octets ) Table de collationnement.

emmet
Download Presentation

Informatique Cours 9 12/11/2001

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. InformatiqueCours 9 12/11/2001 Algorithmique et programmation

  2. Les caractères • Ensemble ordonné • Codage ASCII ( 7 bits: 27 = 128 codes ) American Standard Code for Information Interchange ASCII étendu ( 8 bits ) ISO latin-1 UNICODE ( 2 octets ) • Table de collationnement

  3. Les caractères (rappel) • CARACTERES constantes ‘ A ’ ‘ c ’ ‘ 7 ’ variables j, k: caractères corps k <-- ‘ A ’ j <-- k

  4. Les caractères (rappel) constantes z = ‘ A ’ lecar = ‘ c ’ chif = ‘ 7 ’ variables j, k: caractères corps k <-- ‘ A ’ ; j <-- k lire ( j ) ; écrire ( k > j ) écrire ( chif, lecar, z )

  5. Les caractères (rappel) • CARACTERES expressions lire(z) k <--‘ A ’ j <-- z écrire ( k > j )

  6. Les caractères Bloc caract constante c = ‘ A ’ variables k, z: caractères corps k <-- c lire ( z ) tant que z ≠ ‘ 0 ’ faire écrire (k, ‘ > ’,z, ’ ‘, k > z) lire ( z ) ftant Fin bloc 1_caracteres ƒ

  7. Les caractères (codage) Bloc codage variables x, y: caractères corps x <-- ‘ A ’ y <-- ‘ B ’ écrire ( x, y ) Fin bloc 2_codage ƒ

  8. Les caractères (fonctions) 2a_posval ƒ 2b_test_car ƒ

  9. Les caractères (suite) Exemples: Prédécesseur - successeur DNA Conversions Chaînes - concaténation

  10. Les caractères: fonctions Bloc pred_succ Variable k: caractère Corps lire ( k ) tant que k ≠ ‘ 0 ’ faire écrire (prédécesseur(k), k, successeur(k)) lire ( k ) Ftant Fin bloc 3_predsucc ƒ

  11. Les caractères: application • The nucleotide sequences of genes of Escherichia coli CCCGGGTTCATTGTGCGAAGGCATGGCATATTTGTTCCCGGTGTCGTCAGCAGCATAATTCGACTCTCCATCTGCTGTGTGGCCAGACAAAAGATGGCCTTGTTTGCCGCGGTGGAAATGGAGGGAGGA… Guanine (G), Adenine (A), Thymine (T), Cytosine (C) Each set of three nucleotides represents an amino acid, or codon

  12. Les caractères: application Bloc dna Variables c: caractère ; n: vecteur[1..5] d ’entiers corps n <-- 0 ; lire ( c ) tant que c <> ' ' faire selon que c est 'a ’ : n1 <-- n1 + 1 'c ’ : n2 <-- n2 + 1 'g ’ : n3 <-- n3 + 1 't ’ : n4 <-- n4 + 1 autrement n5 <-- n5 + 1 fin selon lire(c) ftant écrire(n) fbloc 4_dna ƒ

  13. Les caractères: conversions Bloc conversion Type w = chaîne Variables texte: w Corps lire(texte) écrire ( lenombre(texte) ) fbloc

  14. Les caractères: conversions Fonction lenombre ( t: w ): entière Variables z, k: entiers Corps z <-- 0 pour k de 1 à N faire z <-- z * 10 + position(tk) - position (‘ 0 ’) lenombre <-- z Fin fonction 5_conversion_1 ƒ

  15. Les caractères: conversions Fonction lenombre2 ( t: w ): entière Variables z, k : entiers ; u : caractère convers: vecteur ‘ 0 ’.. ’9 ’ d ’entiers Corps k <-- 0 pour u de ‘ 0 ’ à ‘ 9 ’ faire conversu <-- k ; k <-- k + 1 fpour z <-- 0 pour k de 1 à N faire z <-- z * 10 + converstk fpour lenombre2 <-- z Fin fonction 6_conversion_2 ƒ

  16. Les chaînes de caractères Bloc lecture_fichier; Variables f, g : texte ; j, k : entiers nom_fichier_1, nom_fichier_2, nom_etudiant : chaîne Corps Lire ( nom_fichier_1 ) Ouvrir ( g, nom_fichier_1 ) Pour j de 1 à 2 faire lire ( nom_fichier_2 ) ouvrir ( f, nom_fichier_2 ) pour k de 1 à 10 faire lire ( f, nom_etudiant ); ecrire ( g, nom_etudiant ) fpour fermer_fichier ( f ) Fin pour Fin bloc 7_deux_fichiers ƒ

  17. Les chaînes de caractères Bloc lecture_fichier2; Variables nom_fichier, radical, nom_etudiant : chaîne f : texte ; j : caractère ; k : entier Corps Lire ( radical ) ; Pour j de ‘ 1 ’ à ‘ 5 ’ faire nom_fichier <-- radical // j ouvrir ( f, nom_fichier pour k de 1 à 6 faire lire ( f, nom_etudiant ); ecrire (k, nom_etudiant ) fpour fermer_fichier ( f ) Fin pour Fin bloc 8_concatenation ƒ

  18. Les chaînes de caractères Bloc gestion_chaine; Variables phrase : chaîne j : entier Corps Lire ( phrase ) ; Pour j de 1 à longueur ( phrase ) faire si phrasej ≠ ‘  ‘  faire écrire ( phrasej ) fin si Fin pour Fin bloc 9_gestion_chaine ƒ

More Related