All pastes #381846 Raw Edit

Stuff

public text v1 · immutable
·published 2007-03-05 03:15 UTC
rendered paste body
#include <iostream>
#include <iomanip>

using namespace std;
int main()
{
char ch;
char ans;
char sentence;
int count = 0;
do {
  cout << "Enter a character to count: ";
  cin >> ch;
  cout << "Enter a sentence terminated by a period or question mark:  " << endl;;
	while((ch != '.') && (ch != '?'))
	{
	cin >> sentence;
	if (sentence == ch) 
		{
		count++;
		}
	}
  cout << "The character " << ch << " appeared " << count << " times." << endl;
  cout << "Do another? (y/n)" << endl;
  cin >> ans;
}
while (ans == 'y');
  return 0;
}