Hi, I am trying to make a simple program which will convert a letter to another letter. So I am using the enum statement. The only problem is, that when I try ASKING the user to type a letter (eg, cin >> toConvert) I get an error message:
binary '>>' : no operator found which takes a right-hand operand of type 'main::specialChars' (or there is no acceptable conversion)
#include <string>
#include <iostream>
using namespace std;
int main()
{
string firstLetter;
string lettered;
enum specialChars {a='m', b='l'}; // <--- some letters to convert
enum specialChars toConvert;
cout << "Enter a Letter to convert (a or b)";
toConvert = a; // <---- I want to ASK the user to input a letter instead. It works this way, but not the asking way.
// cin >> toConvert <--- Doesn't work
cout << char(toConvert);
} -----------------
MK
Hope this helps!
binary '>>' : no operator found which takes a right-hand operand of type 'main::specialChars' (or there is no acceptable conversion)
#include <string>
#include <iostream>
using namespace std;
int main()
{
string firstLetter;
string lettered;
enum specialChars {a='m', b='l'}; // <--- some letters to convert
enum specialChars toConvert;
cout << "Enter a Letter to convert (a or b)";
toConvert = a; // <---- I want to ASK the user to input a letter instead. It works this way, but not the asking way.
// cin >> toConvert <--- Doesn't work
cout << char(toConvert);
} -----------------
MK
Hope this helps!