PDA

View Full Version : C++ Code Help


Gumbyboy2006
Jul25-06, 11:35 AM
How I can write a program which reads a sequence of integers and counts how many there are. Print the count. For example, with input 55 25 1004 4 -6 55 0 55, the output should be 8 because there were eight numbers in the input stream. Please help.

0rthodontist
Jul25-06, 12:10 PM
Can you write a program that just reads integers until there aren't any more, then stops?

3trQN
Jul25-06, 12:54 PM
Count the spaces

chroot
Jul25-06, 02:13 PM
Use a while loop, the cin.eof() function, and a counter variable.

- Warren