Write a function named countWords that reads in a line of text into a string variable, counts and returns the number of words in the line. For simplicity assume that the line entered only has characters and spaces.

Solved
Show answers

Ask an AI advisor a question