If you're talking about writing a password-protected program, it's as easy as:
Code:
std::string password;  //A string to hold the input
std::cout << "Enter password: ";   //Ask for the password
std::getline(std::cin, password);    //Let them type a password
if(password != "my_password")     //Check if they got it right
{
   std::cout << "You got the wrong password!";
   return 0;   //If they got the password wrong, quit.
}