/*Program to count the number of lowercase characters entered*/
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<ctype.h>
usingnamespace std;
int main()
{
char ch;
int count=0;
cout<<"Enter Character: ";
cin.get(ch);
while(ch!='\n')
{
if(islower(ch))
{
count++;
}
cin.get(ch); // Missing code
}
cout<<"\nThe number of lowercase characters are: "<<count<<"\n";
system("pause");
return 0;
}
You forgot to tell the program to input (ch) before the next loop, and therefore (ch) remains unchanged. (ch) is not the newline character and unchanged, so (while) condition is always true and therefore the program loops forever.