Removing vowels from file! Help

I can't figure out where is my mistake. It's stuck in loop...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <iostream>
#include <string>
#include <fstream>
#include <cctype>

using namespace std;

const string vowels = "aeiou";
string removeVowels (const string &str);
bool IsVowel (char chr);

int main () {

	string stri = "Uspeshno vnesuvanje na tekst vo fajl. \nBrishenje na samoglaski od fajl. \nDomashna po programiranje.";


	ofstream myFile("D:\domashna.txt", ios::out);
	myFile<<stri;
	myFile.close();


		
	ifstream dac;
	dac.open("D:\domashna.txt", ios::in);
	if(dac.is_open()) {
		while (!dac.eof()) {

			cout<<removeVowels(stri);
		}
	}
		dac.close();
	

	cin.get(); cin.get(); 
	return 0;
}



string removeVowels(const string &str)
{

	string finalString;

	for(int i = 0; i < str.size(); i++)
	{

		if(!(IsVowel(tolower(str[i]))))
		{
	
			finalString += str[i];
		}
	}
    

	return finalString;
}


bool IsVowel(char chr)
{

	for(int i = 0; i < 5; i++)
	{
		
		if(chr == vowels[i])
	
		return true;
	}
    

	return false;
}

how about you just go through every letter in the file and check if its a vowel. if its not do nothing and move to the next character, if it is then delete it? seems simple enough.
Yes...but the i should convert string to char etc etc...without the while(!dac.eof())
it works fine...
Topic archived. No new replies allowed.