I am asking for a single character from the user so i can search for the items in an array that match the character. Each character corresponds with an Enum type. Right now i am using cin.getline but i am getting an error on cin.getline. is there an alternative to using getline but for different variable types like an enum type?
This is what I have
1 2 3 4 5 6 7
Category findCat[1]; //character corresponding to the category to search for
//Categories are : enum Category {SONG, POEM, ESSAY, NOVEL, NOTE};
cout << "Input the category you would like to search for. Input the first character of the category: " << endl;
cin.getline(findCat, 2); //this is where the error is "no instance of overloaded //function matches the argument list
int thisCat = FindCategory(findCat);
There are two forms of getline(). Neither accepts an enum, even if it did, it wouldn't work the way you want since an enum is an integer type, not a character type.
BTW, if the user inputs the first character of the category. how are you going to distinguish between Novel and Note?