Start New Discussion within our Software Development Community

Q:Write a program that reads characters from the user until a * is entered. Your program displays the count of capital case letters, small case letters, vowels (capital or small) and digits.
(Problem)
when user enter input char more than 1 digit as(gggg*) then {cout<<"\nPlease Enter Input\n";} repeats 4 times and then Display You Enter 4 Small case Letter Please Run This Code and tell me the mistake......

My code Is:

#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
    int Capital=0,Small=0,Vowels=0,digits=0;
    cout<<"\nTo Stop Programm Please Enter *\n";
    char x;
    for (int i=0,n=1;i<n;i++,n++){
        cout<<"\nPlease Enter Input\n";
        cin>>x;
        if (x=='a' || x=='A' || x=='e' || x=='E' || x=='i' || x=='I' || x=='o' || x=='O' || x=='u' || x=='U'){
            Vowels++;
        }else if (x>='A' && x<='Z'){
            Capital++;
        } else if (x>='a' && x<='z'){
            Small++;
        } else if (x>='0' && x<='9'){
            digits++;
        } else if (x=='*'){
            cout<<"\nYou Input "<<Capital<<" Capital Case Letters\n";
            cout<<"\nYou Input "<<Small<<" Small Case Letters\n";
            cout<<"\nYou Input "<<Vowels<<" Vowels Case Letters\n";
            cout<<"\nYou Input "<<digits<<" Digits\n";
        } else {
            cout<<"\nPlease Try Again With More Accuracy\n";
        }
    }           
    cout<<"\nThank You For Using SA & AQ\nMeterShaart Funny Software..\n";
    cout<<"\nPress Any Key to Exit\n";

    getch();
    return 0;
}
This article has been dead for over six months. Start a new discussion instead.