我假设这与指针有关,但这是我的代码有错误。显然我还没有完成,但错误在于下面代码中的键。
bool LCR_cipher::iskeysOK()
{
vector<char> v(keys.begin(), keys.end());
std::transform(v[0].begin(), v[0].end(), v[0].begin(), ::tolower);
}
这是头文件
class LCR_cipher
{
public:
// Constructor:
LCR_cipher(char *context_string, char *keys_string);
// Destructor: deallocate memory that was allocated dynamically
~LCR_cipher();
//check whether *keys string has valid LCR encryption value
bool iskeysOK();
//encrypt context string
void encryption();
//unencrypt context string (optional)
void unencryption();
//check whether the context string is encrypted or not
bool isencrypted();
//Retrieve CLR encryption value from *keys string
void getkeys(int& a, int& c);
// output the *context to console
void output_context();
private:
char *context; //array to store context string
char *keys; //array to store encryption keys
bool encrypted; //whether string in *context is encrypted or not
int context_MaxSize;
int context_CurrentSize;
int keys_MaxSize;
int keys_CurrentSize;
}
我在哪里出错?
答案 0 :(得分:3)
下面:
v[0].begin()
v是char的向量,所以v [0]是char,而chars没有方法。