I m 存在试图从txt档案中接线的问题。 我在另一部法典和文件中使用了类似的算法,似乎没有任何问题(所有线都印制)。 然而,当我尝试使用一条线(通常)时,我有直线线=“”。 我的界线不是空洞的,我事先要检查一下档案是否开立。 以下是我方案的职能。 谁能提供某种帮助? 感谢!
我正试图审理A案。
void Database::LoginMenu(string code)
{
cout << endl;
cout << "Thank You for Login In, Would You Like To..." << endl;
cout << "====================================================" << endl;
cout << "A. View your registration information" << endl;
cout << "B. Search for others" << endl;
cout << "C. Search for Upcoming" << endl;
cout << "D. Enter the Database" << endl;
char choice, YN;
cout << endl;
cout << "Please choose an option: ";
cin >> choice;
switch(choice)
{
case A :
{
ifstream myfile("RegistrationInfo.txt");
string line;
if(myfile.is_open())
{
while(!myfile.eof())
{
getline(cin, line);
if(line[5] == : )
{
line = line.substr(7, line.size());
}
if(line == code)
{
while(!line.empty())
{
cout << line << endl;
}
}
}
}
cout << "Would you like to return to the menu? (Y/N)";
cin >> YN;
if(YN == Y )
{
LoginMenu(code);
}
myfile.close();
}
break;
case B :
{
ifstream filein("RegistrationInfo.txt");
string temp, YN, enteredInfo;
int n = 0;
cout << "Who do you wish to search for? :";
cin >> enteredInfo;
while(!filein.eof())
{
getline(cin, temp);
}
}
break;
case C : upcomingComps();
break;
case D : DatabaseMenu();
break;
}
}
这里有几条线构成我的 t。
- CCode: abd50896
- Names: TomMullen NicoleLaBerge
- Compt: Rutgers DanceSport 2012
- Level: Newcomer
- Dance: Tango Waltz Quickstep Rumba ChaCha Jive