Traduction en programme C

HAFIDHOU -  
[Dal] Messages postés 6122 Date d'inscription   Statut Contributeur Dernière intervention   -
Bonjour,
Qui peut me traduire ce programme Pascal en programme C?
Voici le programme:
Pascal

program cryptage?
uses wincrt?
var c:char?
e,m:integer?
begin writeln('entrer un caractere')?
readln(c)?
if c in ['A'..'B'] then
c:=pred (c)?
else if c in ['a'..'z'] then
c:= succ (c)
else if c in ['0'..'9'] then
begin
val(c,m,e)?
c:=chr(ord(9)­m)?
end
else
c:=succ(succ(c)) ?
writeln(c) ?
end.

1 réponse

  1. [Dal] Messages postés 6122 Date d'inscription   Statut Contributeur Dernière intervention   1 108
     
    Salut,

    ton programme Pascal, cela ne serait pas plutôt cela :

    program truc;

    uses
    Crt;

    var
    c: char;
    e, m: integer;
    begin
    Writeln('entrer un caractere');
    Readln(c);
    if c in ['A'..'B'] then
    c := pred(c)
    else if c in ['a'..'z'] then
    c := succ(c)
    else if c in ['0'..'9'] then
    begin
    val(c, m, e);
    c := chr(Ord(9) - m);
    end
    else
    c := succ(succ(c));
    Writeln(c);
    end.

    Dal
    0
    1. Miura564 Messages postés 14829 Date d'inscription   Statut Membre Dernière intervention   1 560
       
      c'est clairement plus lisible...
      0
    2. [Dal] Messages postés 6122 Date d'inscription   Statut Contributeur Dernière intervention   1 108
       
      oui... et il ya des chances que
        if c in ['A'..'B'] then
      soit en réalité
      if c in ['A'..'Z'] then
      0