// C++ program to count occurrences of a given
// character
#include <iostream>
#include <string>
usingnamespace std;
// Function that return count of the given
// character in the string
int countLetterInString(string phase , char c)
{
// Count variable
int cnt = 0;
for (int i=0;i<phase.length();i++)
// checking character in string
{
if (phase[i] == c)
cnt++;}
return cnt;
}
// Driver code
int main()
{
char c;
cout <<"This program counts number of specific characters in phrase."<<endl;
string str;
cout <<"Enter the phrase or hit Enter key to stop: ";
while(getline(cin, str)){
if( ??? )
{
break;
}
else
{
cout << "Enter character to count in phrase: "; cin>>c;
cout <<"There are "<< countLetterInString(str, c)<<" "<<c<<" in the phrase" << endl;
}
}
return 0;
}
can you guys help me which is need to be written in (???) so that when entering Enter key it will exit the programm