Well I got the password code right, I think.
I have a few problems
1) it wont close properly
2) Can someone point me in the right direction to find a tutorial that teach me how to only let the user have 34 tries before it close and also to encrypt the password to a file then decrypt it and compare it to another file that contain the correct password( I think that it use the fstream but I dont know the decrpytion, encryption, compare part )?
Thank you
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
int takingPass();
int i;
int pass1;
char destination[13];
int main()
{
cout << "I'm going to kill your computer if you dont enter the right password!!!"<< endl;
for (i=0; i<13; i++) //user can input max 13 character
{
destination[i] = getch();
cout << "*";
if (destination[i]==13)
{
takingPass();
}
}
}
int takingPass()
{
destination[i] = 0;
pass1 = stricmp(destination,"lovebug"); //compare with name "lovebug"
if (pass1 == 0) // case insensitive
{
cout <<"\nPASSWORD IS CORRECT \n";
}
else //if password is not correct
{
cin.clear(); // clear cin
cout <<"\nPASSWORD WAS INCORRECT\n";
main(); //go to main to do until success
}
return 0; // exit program
}