Page 479 - IT2
P. 479

1     1     1    0     1
                                               1     1     1    1     1

                              3-  Simplifier avec la méthode de Karnaugh la fonction logique Q.

                                              Q
                                                     kl
                                                        00
                                                  mn               01   11   10
                                                  00    1     1    1     1
                                                  01    1     0    0     1
                                                  11    1     1    1     1
                                                  10    1     1    1     1

                                                                 ̅
                                              , , ,  =  +  +

                     Dossier 2: Techniques de programmation structurée


                            Exercice 1: Vérification d’un tableau trié

                             Variable U : Réel [ 100 ]
                             Variable M , x : Entier
                             Début
                                Afficher ( "Donner le nombre des éléments du tableau: " )
                                Saisir ( M )
                                Afficher ( "Donner les éléments du tableau: " )
                                Pour x <- 1 à M
                                     Saisir ( U [ x ] )
                                FinPour
                                Afficher ( "Votre tableau est " & est_trié ( U , M ) & "." )
                             Fin

                             Fonction est_trié ( T : Réel [ 100 ] ; N : Entier ) : Chaîne
                             Variable i , cr , dec : Entier
                             Variable test : Chaîne
                             Début
                                cr <- 0
                                dec <- 0
                                Pour i <- 1 à N - 1
                                     Si T [ i ] <= T [ i + 1 ] Alors
                                          cr <- cr + 1
                                     FinSi
                                     Si T [ i ] >= T [ i + 1 ] Alors
                                          dec <- dec + 1
                                     FinSi
                                FinPour

                                Si cr = N - 1 Alors
                                     test <- "trié croissant"
                                FinSi
                                Si dec = N - 1 Alors
                                     test <- "trié décroissant"
                                FinSi
                                Si cr <> N - 1 Et dec <> N - 1 Alors
                                     test <- "non trié"
                                FinSi

                                Retourner ( test )
                             Fin






                     Filière                    Epreuve                        Session              2/13
                      TDI                 Synthèse V1(Correction)            Juillet 2014
   474   475   476   477   478   479   480   481   482   483   484