C++ Program to see the string stats, Alphabets, digits or special characters...

#include<iostream>

#include<iomanip>

#include<string.h>

using namespace std;

void line()

{

cout<<"========================================\n";

}


int main{

int i,alpha=0,digit=0,spchar=0;

char arr[20];

line();

cout<<"String Programs #9\n";

line();

cout<<"Enter Any values to the String :";

cin.getline(arr,20);

line();

for(i=0;arr[i]!='\0';i++)

{

if(arr[i]>65 && arr[i]<91)

alpha++;

else if(arr[i]>96 && arr[i]<123)

alpha++;

else if(arr[i]>47 && arr[i]<57)

digit++;

else spchar++;

}

cout<<"Alphabets: "<<alpha<<"\n"<<"Digits :"<<digit<<"\n"<<"Special Character :"<<spchar<<"\n";

arr[i]='\0';

Comments

Popular posts from this blog