import java.io.*;
class test
{
public static void main()throws IOException
{
String s,p="";
char ch;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int i,c=0;
//input statement
System.out.println("Enter any string");
s=br.readLine();
s=s+" ";
for(i=0;i<s.length();i++)
{
ch=s.charAt(i);
if(ch!=' ')
{
p=p+ch;
}
else
{
if(p.startsWith("a")p.startsWith("e")p.startsWith("i")p.startsWith("o")p.startsWith("u"))
{
c++;
System.out.println(p.toUpperCase());
}
p="";
}
}
System.out.print("Total Words Starting with Vowels="+c);
}
}
by :
Pradeep Sir
Infonet Global Solutions
E-Block new Tempo Stand, Rajaji puram,
Lucknow-17
mob:- +91-9450821737
That's easy to do!This script will get the POST data from an HTML form and check if it is a vowel.
You need to scan through the string and keep track of the vowelsoccurring. Here is a sample program:#include#includeint countVowels(char[] s){int count = 0, i;for( i=0; char[i] != '\0'; i++){switch(char[i]){case 'a':case 'e':case 'i':case 'u':case 'o': count++;break;}}return count;}int main(){char str[256];printf("Enter the string:\t");scanf("%s", str);printf("The number of vowels in the string are :%d\n", countVowels(str));return 0;}
If you want to do it neat and effortless, you may use enums. public class MyClass { private enum VOWELS { A,E,I,O,U,a,e,i,o,u; } public static void main(String []ar) { String s = "Hello World"; for(VOWELS c : VOWELS.values()) s = s.replace(c.name(), "*"); System.out.println(s); } } . Ram
flow chart
There is no need to assume the length if the sentence is represented by a null-terminated string. The following function will strip out all the vowels in any null-terminated string of any length, returning the number of vowels removed. Note that we don't create a new string, we simply modify the existing one since we know the modified string cannot be any longer than the existing one. If you want to retain the original string, simply make a copy of it before invoking this function. The p variable is a pointer and will initially refer to the first character of str, which is also a pointer. The cnt variable maintains a count of the vowels we removed. We use the str pointer to advance through the string one character at a time. When str is referring to a vowel we simply advance str to the next character leaving p where it is (effectively ignoring the vowels) and increment cnt. When str refers to a non-vowel, we copy the character from str to p and advance both pointers. When str reaches the null-terminator, we place a null-terminator in p and return the value of cnt. If any vowels were found there will be cnt characters beyond the new null-terminator. If the original string was a fixed-length array then you cannot remove these extra characters, but for variable length strings you may wish to reallocate, reducing the size of the allocation by cnt characters. int strip_vowels (char* str) { char * p = str; int cnt = 0; if (str==NULL) return cnt; while (*str != '\0') // test for null-terminator { switch (*str) // test for vowels { case 'a': case 'A': case 'e': case 'E': case 'i': case 'I': case 'o': case 'O': case 'u': case 'U': str++; // str refers to a vowel, so ignore and advance to next character cnt++; // increment the count break; default: *p++ = *str++; // non-vowel -- copy the character and advance both pointers break; } } *p = '\0'; // ensure the modified string is null-terminated! return cnt; }
all words have vowels in them
Some three letter words that start with vowels are:aceampapearearkarmarteareatelfemueraergiceI'llimpinkinnionireirkit'soafoakoaroatofforeouroutughumpurnuse
tryst
Consonants are the letters of the alphabet that are not vowels.
There are 26 vowels in the sentence.
I think that dubious distinction could be awarded to consonants, 21 vowels to 30 consonants in that sentence.
Eggplant? Apple? Orange?
If this sentence is written with vowels, it would look like this: ×Ö²× Ö´×™ חָפְשִׁיָה In this case, you would actually remove the letter vav (ו) when writing this sentence with vowels.
an
"The dog barked loudly."
The sentence is almost perfect. Notice that it also has the occasional vowels y and w in the proper place, although the w is not a vowel here.
Read the characters one at a time, and write an "if" for each of the cases. In each case, if the condition is fulfilled, increment the corresponding counter variable.