Write a program that prompts the user to input a sequence of characters and outputs the number of vowels.
(Use the function isVowel written in Programming Exercise 2.)
Your output should look like the following:
There are # vowels in this sentence.... where # is the number of vowels.
Write a value-returning function, isVowel, that returns the value true if a given character is a vowel and otherwise returns false.
For the input E, your output should look like the following:
E is a vowel: 1When printing the value of a bool, true will be displayed as 1 and false will be displayed as 0.
Write a program that uses the function isPalindrome. Test your program on the following strings:
madam, abba, 22, 67876, 444244, trymeuemyrtModify the function isPalindrome of Example 6-6 so that when determining whether a string is a palindrome, cases are ignored, that is, uppercase and lowercase letters are considered the same.
The isPalindrome function from Example 6-6 has been included below for your convenience.
bool isPalindrome(string str)
{
int length = str.length();
for (int i = 0; i < length / 2; i++) {
if (str[i] != str[length – 1 – i]) {
return false;
} // if
} // for loop
return true;
}// isPalindromeWrite a program that uses while loops to perform the following steps:
Write a program that prompts the user to enter a telephone number expressed in letters and outputs the corresponding telephone number in digits.
If the user enters more than seven letters, then process only the first seven letters.
Also output the - (hyphen) after the third digit.
Allow the user to use both uppercase and lowercase letters as well as spaces between words.
Moreover, your program should process as many telephone numbers as the user wants.
The program should accept input and produce output similar to the example program execution below.
Enter Y/y to convert a telephone number from
letters to digits.
Enter any other letter to terminate the program.
Y
Enter a telephone number using letters: Hello world
The corresponding telephone number is:
435-5696
To process another telephone number, enter Y/y
Enter any other letter to terminate the program.
zWrite a program that mimics a calculator. The program should take as input:
It should then output the numbers, the operator, and the result.
Additional notes:
Some sample outputs follow:
3.5 + 4.0 = 7.50
13.973 * 5.65 = 78.95Write a program that mimics a calculator. The program should take as input:
It should then output the numbers, the operator, and the result. (For division, if the denominator is zero, output an appropriate message. The message should contain the word "error")
Some sample outputs follow:
3 + 4 = 7
13 * 5 = 65Write a program that prompts the user to input a number. The program should then output the number and a message saying whether the number is positive, negative, or zero.
Interest on a credit card’s unpaid balance is calculated using the average daily balance.
Suppose that netBalance is the balance shown in the bill, payment is the payment made, d1 is the number of days in the billing cycle, and d2 is the number of days payment is made before billing cycle.
Then, the average daily balance is:
averageDailyBalance = (netBalance * d1 – payment * d2) / d1If the interest rate per month is, say, 0.0152, then the interest on the unpaid balance is:
interest = averageDailyBalance * 0.0152 Write a program that accepts as input netBalance, d1, payment, d2, and interest rate per month (interestRate).
The program outputs the interest.
Format your output to two decimal places.
Write a program that accepts as input the mass, in grams, and density, in grams per cubic centimeters, and outputs the volume of the object using the formula: volume = mass / density.
Format your output to two decimal places.