Program Polindrom using Freepascal Programming.
What Will I Learn?
We learn how to make a program polindrom using freepascal programming.
and how to using command FOR DOWNTO on Free Pascal
Example A
input = love
polindrom before process is "love"
after the process is "evol"
This means that word is not polindrom
Example B
input = level
polindrom before process is "level"
after the process is "level"
This means that word is polindrom
Requirements
Free Pascal
Difficulty
Basic
Tutorial Contents
Theory
Free Pascal is a programming language that is both applications opensource, can be used by anyone without having to pay, freepascal using codes that are easy to understand, so often used by programmers to create applications education.
Polindrom is a word which when read from the left or right can be read with the same spelling with the same meaning. Polindrom are often used in English, either English or other languages. to specify a word or phrase that is included in a polindrom or not, then I am making an application program polindrom. Palindrom in fact is not only aimed at the words or sentences but could be devoted to the numbers.
Practice
Program Polindrom_by_raghib;
Uses Wincrt;
Var word,hkt,hkt1:string;
i,j:integer;
Begin
Writeln('Program Polindrom');
Writeln('=================');
Writeln;
Write('Please input word/sentence: ');Readln(word);
Writeln;
j:=length(word);
hkt:='';
For i:= 1 to j do
hkt:=hkt+word[i];
For i:= j downto 1 do
hkt1:=hkt1+word[i];
Writeln('before: ',hkt,' after: ',hkt1);
Writeln;
if (hkt=hkt1) then
Writeln('this word is Polindrom!')
else
Writeln('this word not Polindrom!');
End.
the key to this program is on command FOR DOWNTO the line to 15
For i: = j downto 1 do
Looping FOR DOWNTO is basically very similar to looping FOR DO, but looping this time specifically for the iteration is decreasing, from small to large numbers, or from most recently until the start.
The same as FOR looping FOR TO, DOWNTO could also be used for negative values. Of course with the note initial value must be greater than the end value.
After that the program is run by the way did compile it first by pressing the alt + F9
then run the program by pressing the Ctrl + F9
Pascal program consists of 3 parts
1.Opening
This section consists of the title and some of the statements, examples
Program Polindrom_by_raghib;
Uses Wincrt;
Var word,hkt,hkt1:string;
i,j:integer;
2.Content
This part is the content of the programme, consisting of a few revelatory, formulas and processes
Begin
Writeln('Program Polindrom');
Writeln('=================');
Writeln;
Write('Please input word/sentence: ');Readln(word);
Writeln;
j:=length(word);
hkt:='';
For i:= 1 to j do
hkt:=hkt+word[i];
For i:= j downto 1 do
hkt1:=hkt1+word[i];
3.Cover
This section will display the result of the process, e.g.
Writeln('before: ',hkt,' after: ',hkt1);
Writeln;
if (hkt=hkt1) then
Writeln('this word is Polindrom!')
else
Writeln('this word not Polindrom!');
End.
The results of the program
before
Please input word/sentence:
we can type a word or phrase according to our wishes, like the following example
After
the picture above tells us that when we input the word "love" then the program polindrom will turn them over to be "evol", and these words have no meaning so that the word love does not include polidrom.
for example the following picture is an example of the word polidrom, for example, "level" if read upside-down by the program polindrom, then the result is also "levels", and the word has meaning, the word level is Polindrom.
you can try another word like "pop, madam, radar, etc. hopefully this tutorial useful
Finish
Posted on Utopian.io - Rewarding Open Source Contributors
Hey @raghib I am @utopian-io. I have just upvoted you!
Achievements
Suggestions
Get Noticed!
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Upvote me too Bro!!
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Ajari saya dong program
datang aja ke lab kami kak ros, saya dan pak ikbal siap membantu, jgn lupa ajak kawan kita yang lain, ratih, pak linto, eva dll. kita akan saling sharing ilmu
Thanks man!!
for this basic idea!!
it will helo the beginners
hai