Author |
Message |
mac
|
Posted: Tue Dec 10, 2002 9:28 am Post subject: help |
|
|
write a program to count the total number of characters in a series of 10
words that you enter, and compute the average word lenght. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Tue Dec 10, 2002 12:14 pm Post subject: (No subject) |
|
|
use length(text:string) to get the length of the string. Then add them all up and divide by total number of words. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
mac
|
Posted: Tue Dec 10, 2002 1:28 pm Post subject: what |
|
|
what is the code bro |
|
|
|
|
|
Tony
|
Posted: Tue Dec 10, 2002 4:44 pm Post subject: (No subject) |
|
|
come on man, learn to read outside the code box.
where text is the word. and this function outputs the lenght of it.
so
code: |
var text:string := "tony"
var l:int
l := length(text)
put l
|
This will output 4 since word "tony" is 4 characters long.
Understand now? |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Dan
|
Posted: Tue Dec 10, 2002 5:31 pm Post subject: la la la |
|
|
or you can do it the realy cheep way with getch
ie.
code: |
var num:int:=0
var key:string(1)
loop
getch(key)
num += 1
end loop
|
well you will have to put in some if's to stop it.
i dont know why i posted this becuse tony's way is a lot better, oh well |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
Tony
|
|
|
|
|
|