我通常尽量不问问题,但这让我难过了一段时间。所以我的问题是如何在以下代码的“if 语句”中检查字符串 HomeWTD 的值?
主要.cpp:
#include "Header.h"
using namespace Header;
void main()
{
Home();
if (NEED HELP HERE)
{
}
}
页眉.h:
#include <iostream>
#include <string>
#include <fstream>
#include <Windows.h>
//Create A Namespace called "Header"
namespace Header
{
using namespace std;
}
//Functions
string Home()
{
string HomeWTD;
string LoginTxt = "Login";
string RegisterTxt = "Register";
string OptionsTxt = "Options";
string CreditsTxt = "Credits";
string QuitTxt = "Quit";
string HomeHeaderMsg = " Home ";
cout << HomeHeaderMsg;
cout << "----------" << endl;
cout << LoginTxt << endl;
cout << RegisterTxt << endl;
cout << OptionsTxt << endl;
cout << CreditsTxt << endl;
cout << QuitTxt << endl << endl;
getline(cin, HomeWTD);
return HomeWTD;
}
void Register()
{
string UsernameIn;
string PasswordIn;
string UsernameOut;
string PasswordOut;
getline(cin, UsernameIn);
getline(cin, PasswordIn);
ofstream UserFile;
UserFile.open(UsernameIn + ".UserSav");
UserFile << PasswordIn;
};