Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. program cryptage ;
  2. uses wincrt ;
  3. var
  4. m:string;
  5. {********************************premier**************************}
  6. function premier (n:integer):boolean;
  7. var
  8. begin
  9. nb:=0;
  10. test:=false;
  11. for i:=1 to n div 2 do
  12. if n mod i := 0 then nb:=nb+1 ;
  13. if nb:=2 then test:=true ;
  14. premier:=test;
  15. End;
  16. {****************************valide****************************}
  17. function valide (ch:string):boolean;
  18. var
  19. i:integer;
  20. v:Boolean;
  21. Begin
  22. v:=true
  23. i:=0;
  24. Repeat
  25. i:=i+1;
  26. if not (length(ch)>4) and (premier length(ch)) then (v:=false);
  27. until (v=false)or (i=Length(ch));
  28. valide:=v
  29. end;
  30. {*****************************saisie**************************}
  31. procedure saisie (var m:String);
  32. Begin
  33. repeat
  34. writeln ('donner le message a crypter :');
  35. readln (m);
  36. until (valide(m));
  37. end;
  38. {**************************cryptage*************************}
  39. function cryptage (m:string):string;
  40. var
  41. l,i:integer;
  42. Begin
  43. l:=length (m);
  44. p:=1;
  45. for i:= 1 to l div 2 do ;
  46. if p:= l mod i =0 then p:=p*p ;
  47.  
  48. end;
  49. {************************PP***************************}
  50. Begin
  51. saisie (m);
  52. writeln (crypter(m));
  53. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement