Change <iostream.h> to <iostream>, that's the standard C++ way.
Also delete the line
cin >>passage . You're already taking in input with getline(), so no need to do it twice.
And also change
int space; to
int space = 0; . How can your program ++ if it doesn't know the variable's initial value?
Also put this line:
cout<<"the number of spaces is"<<space; outside your for loop. You only want to display this messsage once right?
[edit]
Also (

) , you might want to put a
cin.get() at the end of your loop (right after you output your message. This keeps the console open for you to read what the output of your program is. If you don't put it there, your console window will disappear to fast.
You could also run it from a console window you've already opened, but my guess is that you do not yet know how this works.
Last edited by Nick Evan; Jun 30th, 2009 at 10:52 am.
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Offline 4,132 posts
since Oct 2006