1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
| Subroutine recherche (ncd)
implicit none
integer::ncd
integer::choix_2,choix_3,i,j,nm,flag,annee_rech,annee,choix
character(len=30)::album,album_rech
character(len=30)::auteur_rech,auteur
character(len=2)::type_rech,type
character(len=30)::titre_rech,titre
character(len=3)::choix_rech
Open (1,file='collec',form='formatted',access='direct',status='old',recl=100)
Read (1,rec=1,fmt='(i4)')ncd
choix=-1
Do while (choix/=0)
Print*,'Bienvenue dans le menu de recherche'
Print*,'Choix 1) Vous souhaitez trouver des albums repertories dans la collection?'
Print*,'Choix 2) Vous souhaitez trouver directement une liste de chansons?'
Print*,'Choix 0) Retour au menu principal'
Print*,'Veuillez entrer le numero de votre choix svp'
read*,choix
flag=0
If (choix > 2) then
Print*,'Numero de choix incorrect, retour au menu.'
end if
If (choix == 1) then
choix_2=-1
Do while (choix_2/=0)
Print*,'Vous souhaitez trouver un album a partir de : '
Print*,'Choix 1) Son nom?'
Print*,'Choix 2) Son auteur?'
Print*,'Choix 3) Son style?'
Print*,'Choix 4) Son annee?'
Print*,'Choix 0) Retour au menu précédent.'
Print*,'Veuillez entrer le numero de votre choix svp.'
Read*,choix_2
flag=0
Select case(choix_2)
Case default
Print*,'Numero de choix incorrect, retour au menu.'
Case (0)
Print*,'Retour au menu précédent'
choix_2=0
Case (1)
Print*,'Veuillez entrer le titre de votre album svp?'
Read*,album_rech
do i=2,ncd+1
Read (1,rec=i,fmt='(a30)')album
If (album==album_rech) then
flag=1
open(2,file=album,form='formatted',status='old')
! call affichage
close(2)
end if
If (flag/=1) then
Print*,' Album non trouve dans la collection'
end if
end do
case(2)
print*,"veuillez entrer le nom de l'auteur"
read*,auteur_rech
do i=2,ncd+1
read(1,rec=i,fmt='(a30)')album
open(2,file=album,form='formatted',status='old')
read(2,rec=3,fmt='(a30)')auteur
if (auteur==auteur_rech) then
flag=1
! call affichage_album
end if
if (flag/=1) then
print*,"aucun album dans la collection ne contient ce nom d'auteur"
end if
end do
case(3)
print*,"veuillez entrer le type de l'album"
read*,type_rech
do i=2,ncd+1
read(1,rec=i,fmt='(a30)')album
open(2,file=album,form='formatted',status='old')
read(2,rec=2,fmt='(a30)')type
if (type==type_rech) then
flag=1
! call affichage_album
end if
if (flag/=1) then
print*,'aucun album ne correspond a ce type dans la collection'
end if
end do
case(4)
print*,"veuillez entrer l'annee de l'album recherche"
read*,annee_rech
do i=2,ncd+1
read(1,rec=i,fmt='(a30)')album
open(2,file=album,form='formatted',status='old')
read(2,rec=5,fmt='(i4)')annee
if (annee==annee_rech) then
flag=1
! call affichage_album
end if
if (flag/=1) then
print*,'aucun album ne correspond a cette annee dans la collection'
end if
end do
end select
end do !do while choix_2
end if !choix=1
If (choix == 2) then
choix_3=1
do while (choix_3/=0)
Print*,'Choix 1) Vous souhaitez trouver une chanson a partir de son nom? '
Print*,"Choix 2) Vous souhaitez trouver toutes les chansons d'un meme type?"
Print*,"Choix 3) Vous souhaitez trouver toutes les chansons d'un meme auteur?"
Print*,"Choix 4) Vous souhaitez trouver toutes les chansons d'une annee?"
Print*,'Choix 0) Retour au menu precedent'
Print*,'Veuillez donner le numero de votre choix svp ex :1'
Read*,Choix_3
flag=0
select case (choix_3)
Case default
Print*,'Numero de choix incorrect, retour au menu.'
Case (0)
Print*,'Retour au menu précédent'
choix_3=0
case (1)
Print*,'Donnez le titre de votre chanson même partiel svp'
call recherche_partielle
case (2)
Print*,'Donnez le type de chansons recherche svp. Ex : pk, hv...'
Read*,type_rech
do i=2,ncd+1
read(1,rec=i,fmt='(a30)') album
open(2,file=album,form='formatted',status='old')
read(2,rec=3,fmt='(a2)') type
if (type==type_rech) then
flag=1
read(2,rec=6,fmt='(i2)') nm
do j=7,7+nm
read(2,rec=j,fmt='(a30)')titre
print*,titre
end do
end if
end do
if (flag/=1) then
print*,'pas de resultats pour votre recherche'
end if
case (3)
print*,"veuillez entrer le nom de l'auteur recherché"
read*,auteur_rech
do i=2,ncd+1
read(1,rec=i,fmt='(a30)') album
open(2,file=album,form='formatted',status='old')
read(2,rec=3,fmt='(a30)') auteur
if (auteur==auteur_rech) then
flag=1
read(2,rec=6,fmt='(i2)') nm
do j=7,7+nm
read(2,rec=j,fmt='(a30)')titre
print*,titre
end do
end if
end do
if (flag/=1) then
print*,'pas de resultats pour votre recherche'
end if
case (4)
Print*,"Veuillez entrer l'annee recherchee svp"
Read*,annee_rech
do i=2,ncd+1
Read(1,rec=i,fmt='(a30)')album
Open(2,file=album,form='formatted',status='old')
Read(2,rec=5,fmt='(i4)')annee
If (annee==annee_rech) then
flag=1
read(2,rec=6,fmt='(i2)')nm
do j=7,7+nm
read(2,rec=j,fmt='(a30)')titre
print*,titre
end do
end if
end do
If (flag/=1) then
print*," Pas de morceaux pour l'annee recherchee"
end if
end select
end do !do while choix_3
end if !choix=2
end do !do while choix
end subroutine recherche |
Partager