I have noticed many beginners programming in C++ adding password functions to their code which are invoked at beginning of execution. I felt that implementation of the Digital Signature concept will be much more effective/interesting. A digital signature is basically a pen drive like thing that stores a password in a heavily secure format. Well a basic programmer doesn’t need that hell lot of security, but the concept can be made use.
Most students whose only previous experience in C++ is from the +2 may not know to access files in another location other than the bin (or folder of execution).Well that can be done as below .

ifstream i;
i.open(“D://file”);

Just use // instead of the single / which is usually used while specifying the pathnames.
Well back to the password code….You must have already guessed…Use a pen drive to store a file containing your password, preferably in any encrypted format by using basic arithmetic operations and make the password function to read the file, decrypt the password and continue with the execution.
You may add a bit of prank like an infinite loop for a wrong password or accept an fake password and read the real password from file in the background………
I also add a sample code implementing the above tasks..

The password code


The above code decrypts a password encrypted by the following code..


Password file