Exforsys

Free Training

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 ...

Go Back   Exforsys > Programming Talk > C and C++

Exforsys.com


C and C++ C and C++

Reply

 

LinkBack Thread Tools Search this Thread
  #1 (permalink)  
Old 02-27-2010, 01:15 AM
Junior Member
 
Join Date: Feb 2010
Posts: 2
dilah JD is on a distinguished road
Unhappy 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-01-2010, 02:13 AM
kiruthika_sri's Avatar
Junior Member
 
Join Date: Feb 2010
Posts: 4
kiruthika_sri is on a distinguished road
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);
        }
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-02-2010, 12:07 AM
Junior Member
 
Join Date: Feb 2010
Posts: 2
dilah JD is on a distinguished road
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..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Reversing the sentence Adrian C and C++ 1 06-11-2006 06:43 PM


All times are GMT -4. The time now is 07:25 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
Copyright 2004 - 2009 Exforsys Inc. All rights reserved.