This is my code for a program that is supposed to prompt the user to provide a single letter, and then reports whether the letter is a vowel or consonant:
#include <iostream>
using namespace std;
int main() {
cout << "input a single letter";
int var;
cin >> var;
int vowel = 'a','e','i','o','u';
int consonant = 'b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z'
if (var == vowel) {
cout << "vowel";
} else if (var == consonant) {
cout << "consonant";
} else if (var != vowel && var != consonant) {
cout << "Error";
}
return 0;
}
I am very very new at C++, and am trying to learn why I'm getting an error message.