hi im writing a program to decode a morse code message. my program compiles without any error but nothing happens when i enter my code to be decoded. i think there might be something wrong in the "int main()" part of my program. i could really use some help.
char Code:: decode(string c)
{for (int i=0;i<alpha.size();i++)
{if(c == codewords[i]) //looks for codeword[i] and matches it with alpha [i]
{return alpha[i]; //returns c as a char in alpha
}
}
}
vector<char> Code::alphacode()
{vector<char> temp; // returns a vector containing the alphabet A-Z and " " and "."
for (char c='A'; c<='Z'; c++) //returns the letters
temp.push_back(c);
temp.push_back(' '); //returns the space space
temp.push_back('.'); //returns the period.
return temp;
}
int main()
{vector<string> message; //this is the int main code for decode
string temp;
Code c;
cin >> temp;
while (cin.good())
{message.push_back(temp);
cin >> temp;
}
cout << c.decode(message) << endl;
}