// Program CountUC counts the number of uppercase letters
// on a line.
#include <iostream>
using namespace std;
bool IsUppercase(char);
int main ()
{
char letter;
int letterCt = 0;
cout << "Please enter a sentence: " << endl;
cin.get(letter);
while (letter != '\n')
{
if (IsUppercase(letter));
letterCt++;
cin.get(letter);
cout << letterCt << endl;
}
return 0;
}
bool IsUppercase(char letter)
{
return (letter >= 'A' && letter <= 'Z');
}
#include <iostream>
usingnamespace std;
bool IsUppercase(char);
int main()
{
char letter;
int letterCt = 0;
cout << "Please enter a sentence: " << endl;
cin.get(letter);
while(letter != '\n')
{
if(IsUppercase(letter)); // The ; is ending the if() statement
letterCt++; // this is not in the if statement
cin.get(letter);
cout << letterCt << endl;
}
return 0;
}
bool IsUppercase(char letter)
{
return (letter >= 'A' && letter <= 'Z');
}