Guest User

Untitled

a guest
May 17th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 1.20 KB | None | 0 0
  1. with Ada.Text_IO, Ada.Strings.Unbounded, Ada.Strings.Unbounded.Text_IO;
  2. use Ada.Text_IO, Ada.Strings.Unbounded, Ada.Strings.Unbounded.Text_IO;
  3.  
  4. procedure visual_cryptography is
  5. I : Integer := 1;
  6. Datei1, Datei2 : File_Type;
  7. VC1, VC2 : Unbounded_String;
  8. VC1_Z, VC2_Z : Character;
  9. Erg_Zeichen : Character;
  10. begin
  11.    Open (Datei1, Ada.Text_IO.In_File, "vc1.vcf");
  12.    while not End_Of_File (Datei1) loop
  13.       Insert (VC1, Length (VC1) + 1, Get_Line (Datei1));
  14.    end loop;
  15.    Open (Datei2, Ada.Text_IO.In_File, "vc2.vcf");
  16.    while not End_Of_File (Datei2) loop
  17.       Insert (VC2, Length (VC2) + 1, Get_Line (Datei2));
  18.    end loop;
  19.    Close (Datei1);
  20.    Close (Datei2);
  21.    while I <= Length (VC1) loop
  22.       while I <= Length (VC2) loop
  23.          VC2_Z := Element (VC2, I);
  24.      exit;
  25.       end loop;
  26.       VC1_Z := Element (VC1, I);
  27.       if VC1_Z = '-' and VC2_Z = '-' then
  28.          Erg_Zeichen := '0';
  29.       elsif VC1_Z = '+' or VC2_Z = '+' then
  30.          Erg_Zeichen := '#';
  31.       elsif (VC1_Z = '?' or VC2_Z = '?') and VC1_Z /= '+' and VC2_Z /= '+' then
  32.          Erg_Zeichen := '.';
  33.       end if;
  34.       Put (Erg_Zeichen);
  35.       I := I + 1;
  36.    end loop;
  37.    Put (Erg_Zeichen);
  38. end visual_cryptography;
Add Comment
Please, Sign In to add comment