An application using Pascal language on Lazarus

5 pts.
Tags:
Computer programming
Pascal
Question: Create a message encryption system application that translates every message character to its ASCII equivalent and pads the resultant code with a chosen random key based on an addictive operation. **Answer:**
program Encrypt;
type
tab=array[1..255] of byte;

function Sum(T:tab):integer;

var
i,s:integer;

begin

S:=0;
for i:=1 to length(T) do

s:=s+T[i];

sum:=s;

end;
var

s: string;

ascii: array [1..255] of byte;

i,code: integer;
begin;

write('Enter a string: '); readln(s);

for i:=1 to length(s) do

ascii[i]:=ord(s[i]);

{ s[i] accesses each element of the string as a char.
ord returns the ASCII value of the char. }

writeln('ASCII vals: ');

for i:=1 to length(s) do

write('|',ascii[i],'|');

{ Generate a random key }

code:=Random(1000);
w
riteln;
writeln('the random key is : ',code);
writeln('the encrypted message is :',sum(ascii)*code);

end.
After showing this to him, he said I should use Lazarus to create the application and use A menu that can allow me choose to input a string and then encrypt it. I have tried it on Lazarus but failed and I didn't understand the menu. Please I need help. It's an assignment.
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: