Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {Encrypt the message }
- {Make a board with m*n size }
- {Write the message into the board with VertDir, each box contains a letter}
- {Write the message in HorizDir, that is the encrypted message }
- {For example: }
- {Normal Message: "This_is a_test" }
- {Board size: 2*7 }
- {Board: }
- { T i _ s a t s }
- { h s i _ _ e t }
- {Encrypt Message: "Ti_satshsi__et" }
- {See? Nobody will understand}
- {This is useful when you need to have a secret conversation with someone }
- {Every one is the conversation need to use this program }
- {This program can use files to send messages, or you can directly send msg}
- {This program will have Graphic User Interface soon }
- {Enjoy this lame program }
- {You need to make 2 files }
- Program Sec_Msg;
- Uses crt;
- Var
- A: Array [1..100,1..100] of char;
- i, j, m, n, k: Integer;
- S, Files, Msg, RecFiles: String;
- Ans: char;
- f: Text;
- Procedure Send;
- Begin
- clrscr;
- Write('Input size of board: '); Readln(m, n);
- Write('Input message: '); Readln(S);
- Write('Input file: '); Readln(Files);
- k:=1;
- For i:=1 to m do
- For j:=1 to n do
- Begin
- A[i,j]:=S[k];
- k:=k+1;
- End;
- Msg:='';
- For j:=1 to n do
- For i:=1 to m do
- Msg:=Msg+A[i,j];
- Assign(f,Files);
- Rewrite(f);
- Writeln(f,Msg);
- Close(f);
- End;
- Procedure Receive;
- Begin
- clrscr;
- Write('Input files: '); Readln(files);
- Write('Input files to receive: '); Readln(RecFiles);
- Assign(f,Files);
- Reset(f);
- Readln(f,S);
- Read(f,m,n);
- Close(f);
- k:=1;
- For i:=1 to m do
- For j:=1 to n do
- Begin
- A[i,j]:=S[k];
- k:=k+1;
- End;
- Msg:='';
- For j:=1 to n do
- For i:=1 to m do
- Msg:=Msg+A[i,j];
- Assign(f,RecFiles);
- Rewrite(f);
- Writeln(f,Msg);
- Close(f);
- End;
- Procedure Nhap;
- Begin
- Write('Receive or Send? (R/S) ');
- Ans:=ReadKey;
- While (Upcase(Ans)<>'R') and (Upcase(Ans)<>'S') do
- Begin
- Writeln('Press again: ');
- Ans:=Readkey;
- End;
- If Upcase(Ans)='R' then
- Receive;
- If Upcase(Ans)='S' then
- Send;
- End;
- Begin
- clrscr;
- Nhap;
- End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement