Hey guys!
I'm going to start learning C/C++ (again), and I want to start with a very simple program.
It should ask to the user a number and, if it is right, run a program.
Its been a long time that I don't even touch anything from C, but I think that it might look something like this:
void main()
{
int password; //the password will be numerbers only
printf("Please enter the password:\n");
scanf("%d", &password);
if(password == "123456"
{
//code to run external app here
}
else
{
//error message here
}
}
//eof
Is this right? I've been looking for how to start a process, and I ended up with ShellExecute()
and CreateProcess()
. I'm not going to pass any args to the program, I just need to make sure to run it only if the correct password has been entered. Which one is best?
Thanks! /* sorry for the non-idented code, I'm not using any IDE right now */