
Here is the prompt:
Write a program that prompts the user to input a string. The program then uses the function substr to remove all the vowels from the string. For example, if str = "There", then after removing all the vowels, str = "Thr". After removing all the vowels, output the string. Your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel.
I need help with my C++ code. My code only produces the correct output some of the time, so I'm not sure where I'm going wrong here.
I type a word like 'Baseball' and it outputs 'Bsbll.' So it works great, perfect. BUT then I type something like 'Equation' and it only removes some of the vowels.

![8.
#include <iostream>
9.
#include <string>
10
using namespace std;
11
string removevowels (string&);
-bool isVowel (char ch) {
E switch (ch) {
12
13
14
15
case 'A':
16
case 'E'
17
case
'I':
18
case
'O':
19
case
'U':
20
case
a':
21
case
e':
22
case
23
case
o':
24
case
u':
25
case
26
return true;
27
default:
28
return false;
29
30
31
32 Estring foundVowel (int x, string input) {
for (x = 0; x < input.length (); x++)
if (isVowel (input [x])) {
input
33
{
34
35
input.erase (x,1);
36
37
}
38
return input;
39
40
41
int main ()
42 B{
43
44
// exercise #4, page 518
45
int x = 0;
char ch = ' ';
string input;
cout << "Please enter any word:
getline (cin, input);
46
47
48
<< endl;
49
50
cout << "Without vowels:
<< foundVowel (x, input) << endl;
51
cout << endl << endl;
52](https://content.bartleby.com/qna-images/question/ad3ee529-81b1-486a-8459-b4eea2f68af5/0fa82582-8144-4a55-b9e9-e4b665cbc9ec/iir7waf_thumbnail.jpeg)

Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images

- 1 – Write a python program that prompts the user to enter a string and checks if the string contains vowels or not. If the string contains any vowels, it should print “This string contains vowels” otherwise it should print “This string does not contain any vowels”.arrow_forward1. strcmp( str1, str2 ); returns the value 0 if str1 and str2 are equal. a. true b. false 2. The strlen function returns the _________. a. number of characters in a string, including the null terminator b. number of characters in a string, not including the null terminatorarrow_forwardplease create the c++ code regarding this screenshot question i added and also please add professional comments at each line of the code using // commandarrow_forward
- In Python Write a program that reads a string from the user containing a date in the form mm/dd/yyy. it should print the date in the format March 12, 2018.arrow_forwardCode is in C++ Instructions Write a program that reads in a line consisting of a student’s name, Social Security number, user ID, and password. The program outputs the string in which all the digits of the Social Security number and all the characters in the password are replaced by x. (The Social Security number is in the form 000-00-0000, and the user ID and the password do not contain any spaces.) Your program should not use the operator [] to access a string element. Input is as follows highlighted in bold John Doe 333224444 DoeJ 123Password My problem is with my output, i am close with the code, but i have attached what happens on my output and i cannot figure out why? You can see how it prints out multiple times but i am lost? The terminal image is also attached. Thank you! Here is the code: #include <iostream> //include statement(s)#include <iomanip>#include <string> using namespace std; //using namespace statement(s) void getInfo(string info); //void…arrow_forwardWrite a function that accepts a string as an argument and returns true if the argument ends with the substring .doc'. Otherwise, the function should return falsearrow_forward
- Use Character.isDigit(c) Have the user enter a password. The code loops through each character in the string. Add code in the middle section to count how many digits, uppercase and lowercase characters there are. If they have at least one of each, print that their password is ok, otherwise print that the password is not strong.Your program should prompt the user with the following. Enter Password: Below is sample input to test your program. secret Your program should output the following Not Strong Skeleton: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Password: "); String password = scan.nextLine(); int upperTotal = 0; int lowerTotal = 0; int digitTotal = 0; for (int i = 0; i < password.length(); ++i) { char c = password.charAt(i); // Code to count what character c is here // Do not…arrow_forwardpython Please Write a function that finds the number of occurrences of a specified character in a string using the following header: def count(str, c) ex: count("welcome", "e") returns 2.arrow_forwardC program Write 2 functions that can convert an input string to all lowercase and to all uppercase. Write a program to illustrate the use of these 2 functions. Test Data: Input the string: ComputerEngineering Output: Lowercase: computerengineering Uppercase: COMPUTERENGINEERINGarrow_forward
- Lab Activity for the students: Exercise 5: Write a program that asks the user to input a letter. The program finds and prints if the letter is uppercase or lowercase. Then, the program asks the user to input a string and get a three-character substring from the beginning of the string. (1 Mark ) Example : If the inputs are 'y' and "Community". Then, the program will print: y is lowercase The substring is: Comarrow_forwardIn C++arrow_forwardCreate a function that will test if a string is a valid PIN or not via a regular expression. A valid PIN has: Exactly 4 or 6 characters. Only numeric characters (0-9). • No whitespace. Examples validate("121317") → true validate("1234") → true validate("45135") → false validate("89abc1") → false validate("900876") → true validate(" 4983") falsearrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





