answersLogoWhite

0


Best Answer

<html>

<head>

<title>Assignment1</title>

</head>

<body>

Enter the String:<br><br>

<form action="ass1.php" method="post">

Name: <input type="text" name="fname" />

<input type="submit" name="Submit" />

</form>

<?php

if(isset($_POST['Submit']))

{

$vowels=array("a","e","i","o","u");

$length=strlen($_POST['fname']);

$count = 0;

for ($i = 0; $i!= $length; $i++)

{

if (array_search($_POST['fname'][$i], $vowels))

{

$count++;

}

}

}

echo 'There are ('.$count.') vowels in the string ('. $_POST['fname'].')';

?>

</body>

</html>

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

// an extension or utility class of char data type

public class CharExtension {

private const string _VOWELS = "AEIOU";

private const string _CONSONANTS = "BCDFGHJKLMNPQRSTVWXYZ";

public static bool IsVowel(char c) {

return IsOneOf(_VOWELS, c);

}

public static bool IsConsonant(char c) {

return IsOneOf(_CONSONANTS, c);

}

//return true if testChar is one of the characters in charSet

//false otherwise.

//Note case insensitive

private static bool IsOneOf(string charSet, char testChar) {

return charSet.Contains(testChar.ToString().ToUpper());

}

}

Please note that a character maybe neither a vowel nor a consonant, such as a comma. This was why above code did notcoded as return !IsVowel(c) for the function of IsConsonant(c).

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a program in c sharp to identify whether a character vowels and consonants?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write a C program to find out whether character passes through keybroad is a digit or not?

hey..it s simple..make use of built-in function isdigit(character)..it s in stdlib.h...


How do you identify the character in a string is uppercase?

In order to find whether a character in a string is in uppercase or not, you need to use the ascii\unicode values of the character. You may want to use the following code-- String str="Your Sample String Here"; //(say you have this string) int l=str.length(); for(int i=0;i&lt;l;i++) { char ch=str.charAt(i); if(ch&gt;=65&amp;&amp;ch&lt;=90) //Since the values of block letters in ASCII are from 65 to 90 System.out.println(ch); } //This program basically prints out the block letters, but you can modify it as you like, by changing the statement after 'if' as you want


How does computer know whether an instruction you typed is a program?

its nice


Write a program to initialize a character and print whether it is uppercase lowercase or special character in java module 1?

I'll just write a function to do that, I hope the good people won't try to run it as it is.... void function() { char c = 'a'; if( c &gt;= 'a' &amp;&amp; c &lt;='z' ) System.out.println("LowerCase"); else if( c&gt;='A' &amp;&amp; c &lt;='Z' ) System.out.println("UpperCase"); else System.out.println("Special Character"); }


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.

Related questions

How many consonants are there in the word gymnasium?

5 or 6. It depends on whether or not you want to count "y" as a vowel. If you do, there are 5 consonants.


Write a C program to find out whether character passes through keybroad is a digit or not?

hey..it s simple..make use of built-in function isdigit(character)..it s in stdlib.h...


What masters programs options do you have with degree in sports management?

You can pursue almost any master's degree you wish. You just have to identify which program it is and inquire about the required prerequisite coursework particular to the program. Then it will be up to you whether you are willing to complete those prerequisites (if any). It depends on the specific program of study.


How would you recognize a Baha'i?

By the character of their conduct. How would you recognize a Christian or a Zoroastrian? There are no physical characteristics by which to identify a peson's religion, but there are ways to recognize whether someone lives according to the teachings of their Faith.


Is shame a sign of your character?

No. It shows character whether you can get past it.


What is program icon appears regardless of whether the program is open?

pinned


How do you identify whether apple are sweet or not?

if they have little spots they are sweet


How do you identify the baby's gender?

look whether its got apenis or


An insurance carrier whether a private or a government program is referred to as a what?

An insurance carrier, whether a private carrier or a government program, is referred to as


A patient exhibits a boil on his neck what is the procedure to identify and determine whether the causative organism is pathogenic?

A biopsy would be the procedure that would identify and determine whether the causative organism is pathogenic.


How you would you write a program in turbo c7 if letter is vowel or consonant?

You can write a program in Turbo C7 that takes a character as input and checks whether it is a vowel or a consonant by using a simple if-else statement. You can compare the input character with a list of vowels (a, e, i, o, u) and if it matches any of these, then it's a vowel; otherwise, it's a consonant. Print the result accordingly.


How do you identify the character in a string is uppercase?

In order to find whether a character in a string is in uppercase or not, you need to use the ascii\unicode values of the character. You may want to use the following code-- String str="Your Sample String Here"; //(say you have this string) int l=str.length(); for(int i=0;i&lt;l;i++) { char ch=str.charAt(i); if(ch&gt;=65&amp;&amp;ch&lt;=90) //Since the values of block letters in ASCII are from 65 to 90 System.out.println(ch); } //This program basically prints out the block letters, but you can modify it as you like, by changing the statement after 'if' as you want