Vowel program

Jul 24, 2014 at 2:40pm
I need to create a program that outputs whether or not this is a vowel outputting if is true or false. Yet, everything is just outputting that it is not a vowel (output is 0 for letter 'a'.)

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
#include <fstream>

bool isVowel(char ch);

using namespace std;

int main()
{
	ifstream inData;
	ofstream outData;
	
	char vowel;
	
	inData.open("input.txt");
	outData.open("output.txt");
	
	
	
	inData >> vowel;
	
	
	isVowel(vowel);
	
	outData << "The letter tests << isVowel(vowel) << for a vowel. <<endl;
		
	inData.close ();
	outData.close();
	
	system("pause");
	return 0;
}

bool isVowel(char ch)
{
	int value;
	switch(ch) 
	{
	  	case 'a' : case 'A':
	  		value = 1;
	  		break;
	  	case 'e' : case 'E':
	  		value = 1;
	  		break;	
	  	case 'i' : case 'I':
	  		value = 1;
	  		break;
	  	case 'o' : case 'O':
	  		value = 1;
	  		break;
	  	case 'u' : case 'U':
	  		value = 1;
	  		break;
		default:
			value = 0;
	}
  return value;
} 
Jul 24, 2014 at 2:58pm
What is your input file? Also might want to fix your outData statement...you're missing some quotations.
Jul 24, 2014 at 3:01pm
Sorry, I had modified it on my source but nothing is working.
Jul 24, 2014 at 7:27pm
What is the contents of your input file? Also does your input file exist in the same directory as your program?
Topic archived. No new replies allowed.