Consonents Counte in a string

Consonent  Counter :-

#include "stdafx.h"  // Header file for MS VS
#include <iostream>  // Some compiler used < iostream.h>
#include <conio.h>  // header file

using namespace std ;


int main()
{
char input[100] ;
int i = 0 , consonent = 0 ;
cin.getline(input , 100 ,'\n') ;
while (input[i] != NULL)
{
if (input[i] >= 'a' && input[i] <= 'z' || input[i] >= 'A' && input[i] <= 'Z' )
consonent ++ ;
i ++ ;
}
i = 0 ;
while (input [i] != NULL)
{
switch (input[i])
{

case 'a' : case 'e' : case 'i' : case 'o' : case 'u' : case 'A' : case  'E' : case 'I' : case 'O' : case 'U' :
consonent = consonent - 1 ;
default :
break ;
}
i++ ;
}
cout << consonent ;
_getch() ;
return 0 ;

}
Next PostNewer Post Previous PostOlder Post Home

0 comments:

Post a Comment