Need Help Making a program to count spaces in a sentence

Write a function that will count the spaces in given sentence. Think about how your function header should look like. Write also a program to test your function

this is the assignment but im stuck at this, please help.

#include <iostream>
#include <string>
using namespace std;
void countSpaces(string &sentence);
void testSpaces(int &spaces);
int main()
{
string sentence;
cout << "Please Type Your Sentence" << endl;
cin >> sentence;
getline(cin, sentence);


cout << sentence;



countSpaces(sentence);



return 0;

}

void countSpaces(string &sentence)
{



}
Last edited on
Topic archived. No new replies allowed.