我需要从.txt文件中提取用户名和密码,并且我正在困难地考虑如何执行此操作。我会尽力打破这一点。从txt文件中读取用户名和密码
- 打开的用户名
- 文件
- 读取比较对用户输入
- 一个用户名与使用用户名
- 返回true或如果用户名假相关的用户输入的比较密码和密码匹配
是的,这是作业。我正在学习如何在等待USPS发布我的课程TXT书时使用fstream。非常感谢您的帮助!
这是我到目前为止有:
bool User::check(const string &uname, const string &pass)
{
//open the file
fstream line;
line.open("users.txt");
//Loop through usernames
//If a username matches, check if the password matches
}
的user.txt文件,如下所示:
ali87 8422
ricq7 bjk1903
messi buneyinnessi
mike ini99ou
jenny Y00L11A09
end
迈克。 ,我想问你,你认为这个项目的“高层次”目标是什么?它看起来更像是理解fstream ...我是否正确? (教师真的很喜欢这样做,在每个任务中加入“额外学习”,他们认为他们是谁!) – onaclov2000 2011-04-23 03:11:49