I have this program
int main()
{
string valami = "-- .- .-. -.- ------ -- .- .-. -.-";
from_morse_string(valami);
return 0;
}
int from_morse_string(string input_morse_string)
{
string morse_arr[1764];
int j = 0;
stringstream ssin(input_morse_string);
while (ssin.good() && j < 1764)
{
ssin >> morse_arr[j];
++j;
}
for(int i = 0; i < j; i++)
{
switch(morse_arr[i])
{
case ".-" : cout << "a" << endl; break;
case "-..." : cout << "b" << endl; break;
case "-.-." : cout << "c" << endl; break;
...
case "----." : cout << 9 << endl; break;
case "-----" : cout << 0 << endl; break;
default : cout << "it's contain invalid morse code";
}
}
return 0;
}
It's a simple Morse code decoder, a very very simple program but when i want to run I get this error message : "switch quantity not an integer"
What's the problem? How can i solve it?