Saturday, May 22, 2010

How do i make a program in c language that encrypt vowel in a string?

ex: if i input hello the output would be h*ll0

How do i make a program in c language that encrypt vowel in a string?
#include %26lt;stdio.h%26gt;


#include %26lt;string.h%26gt;


#include %26lt;conio.h%26gt;





int main(int argc, char* argv[])


{


const char szVowels[]={'a','e','i','o','u'};


const char szEVowels[]={'@','*','#','0','^'};


char szBuff[100];








printf("Enter string%26gt;%26gt; ");


gets(szBuff);





//iterate thru the input string


for (int ctr=0;ctr%26lt;(int)strlen(szBuff);ctr++)


{


//iterate thru the vowels array


for (int x=0;x%26lt;(int)strlen(szVowels);x++)


{





if (szBuff[ctr] == szVowels[x])


szBuff[ctr]= szEVowels[x];


}





}


printf("New string is: %s",szBuff);


getch();


return 0;


}

sympathy flowers

No comments:

Post a Comment