9
37 번째 줄에있는 fstream을 사용하여 파일을 읽는 중 오류가 발생하지만 (fstream grabpass ("passwords.txt");) 나는 보이지 않습니다. 잘못하고있는 것.변수 'fstream grabpass'에 이니셜 라이저가 있지만 불완전한 유형이 있습니다
#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
int i,passcount,asterisks;
char replace, value, newchar;
string username,password,storedUsername,storedPassword;
int login(string username, string password)
{
if (username=="test"/*storedUsername*/)
{
if (password==storedPassword)
cout<<"Win!";
else
cout<<"Username correct, password incorrect.";
}
else cout<<"Lose. Wrong username and password.";
}
int main()
{
cout<<"Username: ";
cin>>username;
cout<<"Password: ";
do
{
newchar = getch();
if (newchar==13)break;
for (passcount>0;asterisks==passcount;asterisks++)cout<<"*";
password = password + newchar;
passcount++;
} while (passcount!=10);
fstream grabpass("passwords.txt");
getline(grabpass,storedPassword);
grabpass.close();
login(username,password);
return 0;
}
Erm. 내가 왜 그렇게하지 않았어 ... 고마워, 제리. 내 멍청한 실수. –