• Aucun résultat trouvé

Corrigés bac pratique informatique

N/A
N/A
Protected

Academic year: 2022

Partager "Corrigés bac pratique informatique"

Copied!
2
0
0

Texte intégral

(1)Corrigés bac pratique informatique Sections Science de l’informatique 27 Mai 2010(14h30). Corrigé Sujet le 27 Mai 2010 à 14h30. ap. cp ed. ie. .c. om. dec:=0; for i:=1 to length(ch) do if (ch[i] in ['0'..'9'])then begin val(ch[i],v,e); dec:=dec+v*puiss(b,length(ch)-i); end else begin v:=ord(ch[i])-55; dec:=dec+v*puiss(b,length(ch)-i); end; str(dec,chc); convert:=chc; end; procedure transfert(var fd:fdonnee; var ft:text; n:integer); var ligne,chb,res,ch:string; b,i:integer; begin reset(fd); rewrite(ft); for i:=1 to n do begin read(fd,ch); b:=base(ch); res:=convert(ch,b); str(b,chb); ligne:='('+ch+')'+chb+'=('+res+')10'; writeln(ft,ligne); end; close(fd); close(ft); end; procedure remplir(var fd:fdonnee; n:integer); var ch:string; i:integer; begin rewrite(fd); for i:=1 to n do begin repeat writeln('Saisir une chaine contenant des chiffres ou des lettres de A..F: '); readln(ch); until (length(ch)in [1..5]) and (verif(ch)); write(fd,ch);. og. ag. {*******************************sujet bac pratique 2010 G3**************************************} program bacpratique; uses wincrt; type fdonnee= file of string; var ft:text; fd:fdonnee; n:integer; function verif(ch:string):boolean; var i:integer; ok:boolean; begin ok:=true; i:=1; while(ok) and (i<=length(ch)) do if(ch[i] in ['0'..'9','A'..'F'])then i:=i+1 else ok:=false; verif:=ok; end; function base(ch:string):integer; var v,max,e,i:integer; begin if(ch[1] in ['0'..'9'])then val(ch[1],max,e) else max:=ord(ch[1])-64; for i:=2 to length(ch) do begin if(ch[i]in ['0'..'9'])then val(ch[i],v,e) else v:=ord(ch[i])-55; if(max<v) then max:=v; end; base:=max+1; end; function puiss(a,n:integer):integer; var p,i:integer; begin p:=1 ; for i:=1 to n do p:=p*a; puiss:=p; end; function convert(ch:string;b:integer):string; var chc:string; v,e,dec,i:integer; begin. Page 1/2.

(2) ap. cp ed. ag. og. ie. .c. om. end; close(fd); end; procedure affiche(var ft:text; n:integer); var i:integer; ligne:string; begin reset(ft); for i:=1 to n do begin readln(ft, ligne); writeln(ligne); end; close(ft); end; begin assign(fd,'c:\nb_base.dat'); assign(ft,'c:\nombre.txt'); repeat write('saisir n: '); readln(n); until n in [2..10]; remplir(fd,n); transfert(fd,ft,n); affiche(ft,n); end.. Page 2/2.

(3)

Références

Documents relatifs

Correction proposée par Mme Lamia & Mme Hana... Correction proposée par Mme Lamia &

composé mensuellement. S’il veut continuer à verser des paiements de 278$ à la fin de chaque mois, lui sera-t-il possible de rembourser cet emprunt en 4 ans? Montre ton travail

The architecture requires supervi- sion only in the form of matching image pairs and sets the new state-of-the-art on multiple standard semantic align- ment benchmarks, even

we first deal with properties that are independent of the or- dering of data, namely, the backlog and the constraints for the departure process. We first show on this example how

Bob will need to make sure that, while Alice’s rewards do correlate with Charlie’s scores, they also give Alice the in- centives to guarantee that Erin, Dave and Charlie perform

We aim to automate the process of translating a natural language sentence into a structured triple representation defined in the form of subject-predicate-object, s-p-o for short,

Here, influence maximization is used to select homeless youth who will serve as peer leaders and spread messages about HIV prevention through their social network.. Pilot studies

The proposed Hybrid Wavelet Scattering Transform Convolutional Neural Network (HWSTCNN) architecture..