answersLogoWhite

0

#include #include void main() { char string[50]; int vowel=0,consonant=0; cout<<"Enter the string"; cin.getline(string,50); for(int i=0;string[i]!='\0';i++) { switch (string[i]) { case 'a': case 'A': case 'e': case 'E': case 'i': case 'I': case 'o': case 'O': case 'u': case 'U':vowel++; continue; } if (string[i]!=' ') consonant++; } cout<<"No of vowels="<<<"\nNo of consonants="<

User Avatar

Wiki User

16y ago

What else can I help you with?

Continue Learning about Engineering

C plus plus programme to count non-vowels in a file of test?

#include&lt;iostream&gt; #include&lt;fstream&gt; #include&lt;string&gt; int main() { size_t count=0; std::string vowels ("aeiouAEIOU"); std::ifstream ifs; ifs.open ("test.txt", std::ios::in); if (ifs.bad()) { ifs.close(); std::cerr &lt;&lt; "Invalid input file.\n" &lt;&lt; std::endl; return; } while (!ifs.eof()) { char c = ifs.get(); if ((c&gt;='a' &amp;&amp; c&lt;='z') (c&gt;='A' &amp;&amp; c&lt;='Z')) if (vowels.find (c) != vowels.npos) ++count; } ifs.close(); std::cout &lt;&lt; "The file has " &lt;&lt; count &lt;&lt; " non-vowels.\n" &lt;&lt; std::endl; }


Write a program that stores vowels in an array When you program is given a character it should indicate whether the character is vowel or not?

That's easy to do!This script will get the POST data from an HTML form and check if it is a vowel.


Write a program to accept a string from keyboard and count and display the numbers of vowels present in the string by using function?

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;}


How do you write a program to check the string of a given grammar?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; #include&lt;string.h&gt; void main() { char string[50]; int flag,count=o; clrscr(); printf("The grammar is: S-&gt;aS, S-&gt;Sb, S-&gt;ab\n"); printf("Enter the string to be checked:\n"); gets(string); if(string[0]=='a') { flag=0; for(count=1;string[count-1]!='\0';count++) { if(string[count=='b']) { flag=1; continue; } else if((flag==1)&amp;&amp;(string[count]=='a')) { printf("The string does not belong to the specified grammar"); break; } else if(string[count=='a']) continue; else if(flag==1)&amp;&amp;(string[count]='\0')) { printf("The string accepted"); break; } else { printf("String not accepted"); } getch():


To count the number of vowels in a text-flowchart?

flow chart

Related Questions

How do you count the vowels in a string using PHP?

build an array of vowels then do a foreach on the array and then explode the string on the array value and the answer is -1 of the result


Code of find vowels in string in php?

$vowel_arr=array('a','e','i','o','u'); $string="This is my sentence"; $len=strlen($string); $vowel_cnt=0; for($i=0;$i&lt;$len;$i++) { if(in_array($string[$i],$vowel_arr)) $vowel_cnt++; else continue; } echo "Total Vowel count is: ".$vowel_cnt;


C plus plus programme to count non-vowels in a file of test?

#include&lt;iostream&gt; #include&lt;fstream&gt; #include&lt;string&gt; int main() { size_t count=0; std::string vowels ("aeiouAEIOU"); std::ifstream ifs; ifs.open ("test.txt", std::ios::in); if (ifs.bad()) { ifs.close(); std::cerr &lt;&lt; "Invalid input file.\n" &lt;&lt; std::endl; return; } while (!ifs.eof()) { char c = ifs.get(); if ((c&gt;='a' &amp;&amp; c&lt;='z') (c&gt;='A' &amp;&amp; c&lt;='Z')) if (vowels.find (c) != vowels.npos) ++count; } ifs.close(); std::cout &lt;&lt; "The file has " &lt;&lt; count &lt;&lt; " non-vowels.\n" &lt;&lt; std::endl; }


Write a program that stores vowels in an array When you program is given a character it should indicate whether the character is vowel or not?

That's easy to do!This script will get the POST data from an HTML form and check if it is a vowel.


Write a program to accept a string from keyboard and count and display the numbers of vowels present in the string by using function?

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;}


How do you count no of vowels and print also in java?

suppose we have a string String s = "hello how are you..."; char arr[] = s.toCharArray(); for(i = 0; i &lt; arr.length; i++) { if(arr[i] 'u') System.out.println(arr[i]); } that is it .I hope it works.If there is a better process let me know at :- "hello2.abhishek.pal@gmail.com"...


How do you write c program to accept a string from the console and count number of vowels constants digits tabs and blank spaces in a string?

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.


How do you write a program to check the string of a given grammar?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; #include&lt;string.h&gt; void main() { char string[50]; int flag,count=o; clrscr(); printf("The grammar is: S-&gt;aS, S-&gt;Sb, S-&gt;ab\n"); printf("Enter the string to be checked:\n"); gets(string); if(string[0]=='a') { flag=0; for(count=1;string[count-1]!='\0';count++) { if(string[count=='b']) { flag=1; continue; } else if((flag==1)&amp;&amp;(string[count]=='a')) { printf("The string does not belong to the specified grammar"); break; } else if(string[count=='a']) continue; else if(flag==1)&amp;&amp;(string[count]='\0')) { printf("The string accepted"); break; } else { printf("String not accepted"); } getch():


To count the number of vowels in a text-flowchart?

flow chart


Does y count as a vowel in photosynthesis?

No, "photosynthesis" contains other vowels already. The only time when "y" would be considered a vowel is when there are no other vowels in the word.


What is the collective noun for vowels?

There is no specific collective noun for the noun vowels, in which case a noun suitable for the situation can be use, for example a group of vowels, a string of vowels, a bunch of vowels, etc.


How would you implement a substr function that extracts a sub string from a given string?

substr(string, position [, count]) It extract substring starting from start and going for count characters. If count is not specified, the string is clipped from the start till the end