Need help for how to check from txt file

Hello everyone I am really new to C++ and it would be great if you can give me some advice on how to check a username and a password from a txt file. I just started this work and I am stuck at this stage. please i need some advice thanks!

here is the code that stores the information into a txt file.so now i need to check next time that the username and the password are correct.

#include <iostream>
#include <string>
#include <fstream>


using namespace std;

int main ()
{
cout<<"WELCOME"<<endl;
string mystr;
cout<<"Enter your name"<< endl;
getline(cin,mystr);
string data;
cout<<"Enter your pass"<<endl;
getline(cin,data);

ofstream myfile;
myfile.open ("pass.txt",ios::app);
myfile << data << " is the password " << "and the username is " <<mystr;
myfile.close();
}
open the file, read the data and compare the users input with the strings from the file

http://www.cplusplus.com/doc/tutorial/files/
http://www.cplusplus.com/reference/string/string/compare/

thank you very much darkmaster i ll have a look and I will let you know. Appreciate your interest to help me.

Regards,
Kristo
well i went a bit through it but still i am figuring it out. I need a method that will take the mystr && data strings and it should look into the pass.txt file in order to check if the input is stored there. any suggestions ? :(
Topic archived. No new replies allowed.