コマンドプロンプトでユーザーデータベースに取り組んでいます。ユーザー名とパスワードを追加し、サインインすることもできます。コンパイルすると、エラーが発生しますno match for 'operator==' in
。何が原因なのか正確にはわかりません。また、すべてをクラスに保存しました。
私のヘッダーファイルは次のとおりです。
#ifndef USER_PSW_H
#define USER_PSW_H
#include <string>
class User_Psw
{
public:
User_Psw();
void addToDatabase();
void getNameIndex();
bool PasswordMatches();
void UserCheck();
protected:
private:
int sizeOfDatabase;
int index;
std::string Usernames;
std::string Password;
std::string username;
std::string password;
};
#endif // USER_PSW_H
コンストラクターは次のとおりです。
User_Psw::User_Psw()
{
const int SIZE = 100;
index = 0;
sizeOfDatabase = 0;
Usernames[SIZE];
Password[SIZE];
}
実際のエラーのある関数は次のとおりです。
void User_Psw::getNameIndex()
{
for(int i=0; i < sizeOfDatabase; i++)
{
if (username == Usernames[i])
{
index = i;
}
}
}
エラーを含む実際のコード行はif (username == Usernames[i])
必要に応じてコード スニペットを追加することもできます。