<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>
// 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).
hey..it s simple..make use of built-in function isdigit(character)..it s in stdlib.h...
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<l;i++) { char ch=str.charAt(i); if(ch>=65&&ch<=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
its nice
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 >= 'a' && c <='z' ) System.out.println("LowerCase"); else if( c>='A' && c <='Z' ) System.out.println("UpperCase"); else System.out.println("Special Character"); }
That's easy to do!This script will get the POST data from an HTML form and check if it is a vowel.
5 or 6. It depends on whether or not you want to count "y" as a vowel. If you do, there are 5 consonants.
hey..it s simple..make use of built-in function isdigit(character)..it s in stdlib.h...
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.
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.
No. It shows character whether you can get past it.
pinned
An insurance carrier, whether a private carrier or a government program, is referred to as
if they have little spots they are sweet
look whether its got apenis or
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.
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<l;i++) { char ch=str.charAt(i); if(ch>=65&&ch<=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
If you want to check whether a string is a palindrome, you can reverse the string (for example, the Java class StringBuffer has a reverse() method), and then compare whether the two strings - the original string and the reverted string - are equal. Alternately, you could write a loop that checks whether the first character of the string is equal to the last one, the second is equal to the second-last one, etc.; that is, you have a counter variable (in a "for" loop) that goes from zero to length - 1 (call it "i"), and compare character #i with character #(length-i-1) inside the loop.