![]() |
| ||
| pascal word and letter counting hey I am learning pascal and need to write a program where, when the user enters a sentence finishing with a full stop it prints the number of words in the sentance and the number of words with over 3 letters in. I have no idea how to count the words in a sentance or the letters in a word. I also dont no how to regonise the full stop as the end of the sentence. So as you can see im quite stuck! Any help getting started would be much appreciated tom |
| ||
| Re: pascal word and letter counting Quote:
|
| ||
| Re: pascal word and letter counting If you need help getting started, These are Code Blocks I'd use: To get the length of a string: length(<somestring>) {This gives you - have a guess - the Length of a string.} To get only the string until the full stop: var ct:Integer; somestring, croppedString:String; Flag:Boolean; To count the number of letters: var ct,NumOfLetters: Integer; somestring: String; I'll have to think about how to count the number of words with over three letters, though - I'll try to post it tomorrow. Greetz WhiteAvenger |
| All times are GMT -4. The time now is 2:55 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC