944,123 Members | Top Members by Rank

Ad:
0

Arranging strings by alphabet

by on Mar 29th, 2009
This small program shows that how we can arrange
strings by alphabet in a vector.By FlamingClaw
Pascal and Delphi Code Snippet (Toggle Plain Text)
  1. {
  2. This small program shows that how we can arrange
  3. strings by alphabet in a vector
  4. }
  5. Program Program01;
  6. Uses Crt;
  7.  
  8. Const
  9. n=5;
  10.  
  11. Var
  12. szo:Array[1..n]Of String[4];
  13. i:Byte;
  14. j:Byte;
  15. t:String[4];
  16.  
  17. Begin {main}
  18. For i:=1 To n Do
  19. Begin
  20. Write(i,' Give me max 4 chars from the alphabet: ');
  21. ReadLn(t);
  22. szo[i]:=t;
  23. End;
  24. For i:=1 To n-1 Do
  25. Begin
  26. For j:=i+1 To n Do
  27. Begin
  28. If (szo[i]>szo[j]) Then
  29. Begin
  30. t:=szo[i]; {*}
  31. szo[i]:=szo[j];
  32. szo[j]:=t; {*}
  33. End;
  34. End;
  35. End;
  36. WriteLn;
  37. {write the arranged result}
  38. WriteLn('Arranged!');
  39. For i:=1 To n Do WriteLn(szo[i]);
  40. ReadLn;
  41. End.{end of main}
  42.  
  43. {
  44. -= Note By FlamingClaw =-
  45.  
  46. All programs created by me are written and tested
  47. in Dev-Pascal 1.9.2 and/or Turbo Pascal 7.0
  48.  
  49. -= Created By FlamingClaw =-
  50. -=2009.03.29=-
  51. }
Comments on this Code Snippet
Nov 2nd, 2009
0

Re: Arranging strings by alphabet

thanks
Newbie Poster
sobari is offline Offline
1 posts
since Nov 2009
Message:
Previous Thread in Pascal and Delphi Forum Timeline: Read of RS232
Next Thread in Pascal and Delphi Forum Timeline: Simple drawn line a compnent





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC