write a program to accept the string from user and replace all vowel with * and all consaonants with # .for ex. input :- rahul output = #*#*#.

write a program to accept the string from user and replace all vowel with * and all consaonants 
with # .for ex. input :- rahul   output = #*#*#.

solution :-


#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
char ch[100];
int i;
clrscr();
cout<<"enter trhe string\n";
cin>>ch;
for(i=0;i<strlen(ch);i++)
{
if(ch[i]=='A'||ch[i]=='a'||ch[i]=='E'||ch[i]=='e'||ch[i]=='I'||ch[i]=='i'||ch[i]=='O'||ch[i]=='o'||ch[i]=='U'||ch[i]=='u')
{
cout<<" "<<'*';
}
else
{
cout<<" "<<'#';
}
}
getch();
}
==================================================================
try this and dont forget to like or comment .

find the vowel and consanant in string

 Write a Program to find out how many vowel and consonants in string which you entered in c and c++


#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
char ch[100];
int i,total=0; clrscr();
cout<<"Enter the name\n";
cin>>ch;
for(i=0;i<strlen(ch);i++)
{
if(ch[i]=='a'||ch[i]=='A'||ch[i]=='E'||ch[i]=='e'||ch[i]=='I'||ch[i]=='i'||ch[i]=='o'||ch[i]=='O'||ch[i]=='U'||ch[i]=='u')
{
      total=total+1;
}
}
cout<<total;
getch();
}

write a program when user enter the number then output will be the in words.for ex.input 123 end output:-one two three.

solution:-
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
int num,rev=0,rem;
char ch[10]="";  clrscr();
cout<<"enter the numebr"<<endl;
cin>>num;
while(num>0)
{
rem=num%10;
rev=rev*10+rem;
num=num/10;
}
while(rev>0)
{
rem=rev%10;
rev=rev/10;
switch(rem)
{
case 0:
strcpy(ch,"zero");
break;

case 1:
strcpy(ch,"one");
break;

case 2:
strcpy(ch,"two");
break;

case 3:
strcpy(ch,"three");
break;

case 4:
strcpy(ch,"four");
break;

case 5:
strcpy(ch,"five");
break;

case 6:
strcpy(ch,"six");
break;

case 7:
strcpy(ch,"seven");
break;

case 8:
strcpy(ch,"eight");
break;

case 9:
strcpy(ch,"nine");
break;
default:
ch=="";
break;
}
cout<<ch;
}
getch();
}
Blogger Tips and TricksLatest 

Tips For BloggersBlogger Tricks