Skip to content

Posts from Need help with two problems in Turbo Pascal.

PC World Closed Topic
No ratings yet — be the first to rate!
Closed
HELP ME!!!
9 voters
Single choice Closed 2009-11-20
This poll is closed.
I would help you, but I'm pretty useless myself right now.
77.8% 7 votes
Damn, I don't have time for this nonsense!
22.2% 2 votes
User Avatar
Auto-translated
Fellow forum users, I need your help.
I urgently need to solve two problems in Turbo Pascal, but I don't know anything about it. I tried to find ready-made solutions online, but it didn't work. I downloaded and read a textbook, but it was like talking to a brick wall :(
If there is an enthusiast who is familiar with the language and can create at least one program, I will be extremely grateful.
1. To encrypt text written using Russian letters and punctuation marks, you can rewrite it by replacing each letter with the next letter in the alphabet (the letter "я" is replaced with "а").
a) Encrypt the given text.
b) Decrypt the given text.
It's called the Caesar cipher, the most basic one.
As I understand it, after running the program, it asks: What do you need? Encrypt or decrypt? (a or b) You answer it, enter the text, and it encrypts/decrypts.
It seems to be solved in two ways: by linking to a character encoding table or by introducing an array consisting of Russian letters. The second method is preferable because encodings may differ (these are my newbie comments).
2. Given the characters s1, s2, ... It is known that the character s1 is different from the exclamation mark and that among s2, s3, ... there is at least one exclamation mark. Let s1, ..., sn be the characters of the given sequence preceding the first exclamation mark (n is unknown in advance).
Determine whether it is true that among s1, ..., sn there are all the letters that make up the word "шина" (tire).
It's something similar.

The solution is needed by tonight, but there are possible options). Thank you for your attention, with hope in my voice, etc. :)
User Avatar
Auto-translated
I can't help, I'm as clueless as he is. Please, help him! *___*










За всем следят машины благодати и любви.
User Avatar
Auto-translated
Actually, that third one from the top – that’s me. I don’t know Pascal, if I did, I’d help. Register on some forum where there are knowledgeable people, and ask there. P.S. You wrote the topic title in such a noobish way that most of the creatures inhabiting the forum won’t even visit it.
In reply to Imaris
User Avatar
Auto-translated
You guys are flooding the chat... :) Most of the creatures (including 1 wolf) have already checked out the thread, and we thank them for that. One is diligently working on the first task, and we'll soon bring it to completion. Maybe someone else will join in.
User Avatar
Auto-translated
Oh, Cash, sorry, I just read the title of the poll and thought that was the topic name (I followed the link).
I'm an idiot.
P.S. And 1 Lizard has already checked it out!
In reply to Imaris
User Avatar
Auto-translated
The best help is advice! Write to those who create programs for Heroes of Might and Magic on ICQ. They will definitely figure it out.
User Avatar
Auto-translated
Solution to problem 2.
Perhaps it could have been done better, but I studied C++, not Pascal.

var
str1:String;
a,b,c,d,e:Integer;
begin
Write('Enter a string: ');
ReadLn(str1);
a:=pos('ш',str1);
b:=pos('и',str1);
c:=pos('н',str1);
d:=pos('а',str1);
e:=pos('!',str1);
if (a < e) and (b < e) and (c < e) and (d < e) then
Write('Hooray! The word will be formed')
else
Write ('It won't work');
ReadLn;
end.

I assume the first problem has already been solved?
In reply to Avern
User Avatar
Auto-translated
Thank you all very much for your sympathy and attempts to help :smile43:

And a huge thank you to Volodya, Hermit, for both tasks!

P.S. I just sent the solution to the girl (yes, it was for her, why did I need Pascal?), she complained that it was too complicated and not for first-year students, but I was forgiven - and that's great :)

Thanks again to everyone.

Statistics

Welcome our newest member: Emil