Are you talking about a single, predefined password or a serial key?
Neither passwords or serial keys are especially secure in binary files due to the ability to debug programs. You can easily find a string, and you can find the algorithm behind a serial key. Your best bet would probably be to have the program connect to a server to verify the user if you want security.
If you just want to do it for fun, I suppose you could just declare a string and put the password in it. Then ask the user for input and compare the password string with the input.
Here's a quick example.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
std::string password = "mysecretpassword";
std::string input;
std::cout << "Enter password: ";
std::cin >> input;
if(input == password)
{
std::cout << "The password was correct!\n";
}
else
{
std::cout << "The password was wrong!\n";
}