class Code
{
public:
Code();
//string decode(vector< string> message);
private:
//vector<string> codewords;
//vector<char> alpha;
char vector<char> alphacode();
string vector<string> morsecode();
//char decode(string c);
};
Code::Code()
{
}
string Code::vector<string> morsecode()
{
vector<string> temp(28);
temp[0] =".-";
temp[1] ="-...";
temp[2] ="-.-.";
temp[3] ="-..";
temp[4] =".";
temp[5] ="..-.";
temp[6] ="--.";
temp[7] ="....";
temp[8] ="..";
temp[9] =".---";
temp[10] ="-.-";
temp[11] =".-..";
temp[12] ="--";
temp[13] ="-.";
temp[14] ="---";
temp[15] =".--.";
temp[16] ="--.--";
temp[17] =".-.";
temp[18] ="...";
temp[19] ="-";
temp[20] ="..-";
temp[21] ="...-";
temp[22] =".--";
temp[23] ="-..-";
temp[24] ="-.--";
temp[25] ="--..";
temp[26] =".......";
temp[27] ="x";
return temp;
}
char Code::vector<char> alphacode()
{
vector<char> temp;
for (char c='A'; c<='Z'; c++)
temp.push_back(c);
temp.push_back(' ');
temp.push_back('.');
return temp;
}
int main()
{
return 0;
}
这是我到目前为止的代码,但我不知道我的向量类的语法是否正确。另外,我将如何访问代码的 int main() 部分中的向量。抱歉,C++ 的第一季度对这一切还是很陌生。