Facebook
From Terma, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 168
  1. Program terma;
  2. Uses wincrt;
  3. Type
  4. Alphabet = Array [A..Z];
  5. Var
  6. alpha,alphaf:Alphabet;
  7. codef,num,ch1,ch,ch2:string;
  8. code,code1,none,e,ch3,j,alpha1:integer;
  9.  
  10. Begin
  11. Repeat
  12. Writeln('donner ch');
  13. Readln(ch);
  14. For i := 1 to lengh(ch) do
  15. If ord(ch[i]) in [ 65 .. 90 ]
  16. Then
  17. ch1:= ch
  18. Else if ord(ch[i]) = 32
  19. Then
  20. ch2 := ch
  21. Else
  22. ch3:= 0;
  23. Until (length(ch) in [1 ..9]) And (ch3>0) and (Majus(ch[i])= ch[i] ;
  24. Repeat
  25. Writeln('donner entiers');
  26. Readln(num);
  27. Val(num,none,e)
  28. Until (e=0) and (length(num)= length(ch))
  29. For j := 1 to length(ch) do
  30. alpha := ch[j];
  31. If ord(ch[j]) = 32
  32. Then
  33. Alpha1[j] = ''
  34. Else
  35. alpha1 := ord(alpha);
  36. code[j] := alpha1 + num[j];
  37. If code > 26 then
  38. code1[j] := code[j] - 26
  39. Else
  40. code1:= code;
  41. alphaf := code1;
  42. codef := chr(alphaf[j]);
  43. Writeln('Votre code est', codef);
  44. End.