
- Forum
- Programming Talk
- C and C++
- Highlighting Vowel in a sentence
Highlighting Vowel in a sentence
This is a discussion on Highlighting Vowel in a sentence within the C and C++ forums, part of the Programming Talk category; Help me, Write a function to return a nonzero if the character is a vowel (a,e,i,o,u - upper or lower ...
-
Highlighting Vowel in a sentence
Help me,
Write a function to return a nonzero if the character is a vowel (a,e,i,o,u - upper or lower case), or zero if it is not a vowel. Test the function in a program that allows input of string - get() and a single character output - putchar() of the characters in the string with the vowels highlighted as shown.
Example:
Aloysius Washington
<A>l<o>ys<i><u>s W<a>sh><i>ngt<o>n
-
03-01-2010, 03:13 AM #2
- Join Date
- Feb 2010
- Answers
- 4
Code:#include<stdio.h> #include<string.h> main() { char c; char vowel[]="aeiou"; while((c=getchar())!=EOF) { if(strchr(vowel,tolower(c))) printf("<%c>",c); else printf("%c",c); } }
-
wow..
wow..thats easyy~ haha..i did the code already and it sure is LONGGGG..
while((c=getchar())!= EOF){ -----------line 1
if(strchr(vowel,tolower(c))) {------line 2
printf("<%c>",c);---------------line 3
}
Just wonderingg in the line 2 coding..
strchr()? what actually the uses of it? cuz iv actually look in the internet, the result search was to point something and others were to find a character in a string? im not quite sure about it. It would be lovely if you can explain to me. (:
anyway thanks for the coding..
-
Sponsored Ads

Reply With Quote





