In this article I will share a code that I wrote during my college days using Turbo Pascal I called this program reverse a word. What does this program will do is to ask the user a word or string and then it will display the word in reverse order.
If you have some questions please send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com.
People here in the Philippines can contact me at my mobile number 09173084360.
Thank you very much and Happy Programming.
Sample Program Output
Program Listing
Program Reverse;
Uses Crt;
Var InpStr : String;
OutStr : String;
Size, I : Integer;
Begin
Clrscr;
Write('REVERSE A WORD');
Writeln; Writeln;
Write('Please Enter A String :=> ');
Readln(InpStr);
Size := Length(InpStr);
For I := 1 To Size Do
Begin
OutStr[I] := InpStr[Size - (I - 1)];
OutStr[0] := Chr(Size);
End;
Writeln;
Writeln;
Write('The Reversed String is ' ,OutStr,'.');
Readln;
End.
No comments:
Post a Comment