制作循环的问题

Issue with making a loop

#include "stdafx.h"
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
string checkpass(string password1)
{
    string rightpass = "aimen";
    string errormsg2;
    if (password1 == rightpass)
    {
        errormsg2 = "Right";
    }
    else{errormsg2 = "No";}
    return errormsg2;
}
int main()
{
    string password;
    string errormsg;
    cout << "Type the password";
    loop:
    getline (cin,password);
    errormsg == checkpass(password);
    if (errormsg=="Right")
    {
        cout << "Admitted" << endl;
    }
    else {
        goto loop;
    }
    system("pause");
    return 0;
}

控制台不打印单词 "Admitted"。它启动了,但在我输入控制台后,反复没有任何反应。

我请求你的帮助。谢谢。

您正在与 errormsg == checkpass(password); 进行比较什么时候应该分配一个=符号。