Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with Ada.Text_IO, Ada.Strings.Unbounded, Ada.Strings.Unbounded.Text_IO;
- use Ada.Text_IO, Ada.Strings.Unbounded, Ada.Strings.Unbounded.Text_IO;
- procedure visual_cryptography is
- I : Integer := 1;
- Datei1, Datei2 : File_Type;
- VC1, VC2 : Unbounded_String;
- VC1_Z, VC2_Z : Character;
- Erg_Zeichen : Character;
- begin
- Open (Datei1, Ada.Text_IO.In_File, "vc1.vcf");
- while not End_Of_File (Datei1) loop
- Insert (VC1, Length (VC1) + 1, Get_Line (Datei1));
- end loop;
- Open (Datei2, Ada.Text_IO.In_File, "vc2.vcf");
- while not End_Of_File (Datei2) loop
- Insert (VC2, Length (VC2) + 1, Get_Line (Datei2));
- end loop;
- Close (Datei1);
- Close (Datei2);
- while I <= Length (VC1) loop
- while I <= Length (VC2) loop
- VC2_Z := Element (VC2, I);
- exit;
- end loop;
- VC1_Z := Element (VC1, I);
- if VC1_Z = '-' and VC2_Z = '-' then
- Erg_Zeichen := '0';
- elsif VC1_Z = '+' or VC2_Z = '+' then
- Erg_Zeichen := '#';
- elsif (VC1_Z = '?' or VC2_Z = '?') and VC1_Z /= '+' and VC2_Z /= '+' then
- Erg_Zeichen := '.';
- end if;
- Put (Erg_Zeichen);
- I := I + 1;
- end loop;
- Put (Erg_Zeichen);
- end visual_cryptography;
Add Comment
Please, Sign In to add comment