Hi all, sorry to once agian come begging for help, but the professor wants us this time to have the program have a function read the word then for each letter have another function confrim if the letter is a vowel or not, then have the first function remove the vowel from the word. Heres my code and so far having no luck with errors that really are just puzzling me. I've tried working on this code myself for two weeks, without help, but having no luck, and it's already late XD, all of you have been helpful in the past I was hoping I can get help agian heres the code

#include <iostream>
#include <iomanip> 
#include <string>
using namespace std; 
void removeVowel(string);
bool isVowel(char);
int main()

{
	string word;
	cout << "Vowel Remover 1.0" << endl;
	cout << "--------------------------------------------------"<< endl; // just a decoration. 
	cout << "This program will remove any vowel from a word you enter" << endl;
	cout << "Please enter in a word now" << endl;
	getline(cin,word); 
	
	removeVowel(word);

return 0;
}




bool isVowel (char i) 
{
	if (i=='a'||i=='e'||i=='i'||i=='o'||i=='u'||i=='A'||i=='E'||i=='I'||i=='O'||i=='U')
return true;
else 
return false;
}






void removeVowel(string word)
{
	string.str(word)

	for (int i=0; i < string.length();i++)
	{
		if(isVowel(string.at(i))
		{ 
			word{i}= " ";
		}
	}
	cout << word;
}

I don't know what I was attempting to do was have it simply replace the character at that position with white space.

I don't know what I was attempting to do was have it simply replace the character at that position with white space.

Curly braces instead of square brackets...

Edited 6 Years Ago by HealBrains: n/a

I had that, already these are [ sqaures right? and these are { curley correct? Im using { in that code.

I had that, already these are [ sqaures right? and these are { curley correct? Im using { in that code.

And what should you be using? What's you book say?

The book doesn't give any code on this im going off what out professor gave us at the time, and the only thing she gave use was the remove vowel function itself, and the rest of its my own horrid concoction.

Your book doesn't mention how to get a single value from an array? I find that hard to believe.

Noo noo it goes into detail talking about how to do arrays and what not, but it doesn't really talk about how to do this specifically. I figured out that my isVowel function is working it does test for vowels, and ive figured out the problem lies with in the removeVowel function. Sadly i cant figure out whats wrong with my syntax... :-(

What's wrong with this line?

word{i}= " ";

Curly braces instead of square brackets...

You really can't see what's wrong, even with these monster clues?

Edited 6 Years Ago by HealBrains: n/a

This article has been dead for over six months. Start a new discussion instead.