   c++ username Password
  Hi,   I am creating an application i want to know how to create a username and password function using C++ so that password and username will be save forever in database or in .txt file.i thought about a very simple idea like  if (username==somthing) && (password ==somthing){ print();}else {cout<<"Couldnt attenticate you"<<endl;}But this is simple but actually i m looking for more advance idea if somebody can give me a suggestion.Thanks in advanceCheersBobby   
  Use <string>Edit: I thought you wanted help. My bad.   ;  Well, if you want to save the username and password, you could do this:std::ofstream out_file("info.txt");out_file << username << password << std::endl;out_file.close();And to open it you would put:std::ifstream in_file("info.txt");in_file >> username >> password;in_file.close();And that would allow you to save and than load a username and password.Don't forget to #include <fstream>   ;  use <String> ?????????? can you give me any example?   ;  It looks like you need some functions to manipulate files, I would suggest std::ofstream & std::ifstream, but you can also use these functions (in case you've never heard about the Standard Template Library):Obsolete DOS mode functions: _open (), _write (), _close (), _fopen (), _fwrite (), _fclose ()Win32 function: CreateFile (), WriteFile (), CloseHandle ()All these functions are documented in MSDN, for simplicity, I suggest using _open (), _write () and _close ().   ;Quote:Original post by Genius_Bobbyuse <String> ?????????? can you give me any example?Well, I thought that you needed help (your original post wasnt that clear), and because you were doing something with strings, I would suggest you use the c++ <string> library instead of just arrays of char's.   ;  also you could play with encryption.   try MD5 encrypting it before exporting it to a file.   ;foosha1.hpp and sha1.cpp contain a secure hash algorithm class which I derived from some code I stold somewhere.password.cpp contains a UserDatabase class and a test program to manipulate it.The stored passwords look like this:admin:K0J6vJkGwNZgBXw5:a9d91e146c090773b8954bf504e4ae6d9f794a32guest:xNpFRXMsCBjR8AbC:5dfbe52e8c48ff1bdc9cbcae2e35d9e8f25dbb3dsmart_idiot:TduZicCnCutCkYVx:75153b4a23a52f29d18006934549791cc1c575caIn the above example, the passwords are rosebud, (blank), and ********. You can verify them by hand here by concatenating the salt with the password and comparing the resulting SHA-1 hash. For example, the hash of K0J6vJkGwNZgBXw5rosebud is a9d91e146c090773b8954bf504e4ae6d9f794a32.   