Code:
main() {
EnterPassword(6, 5, 9, 3, 1, 5, 6, 3);
}
EnterPassword(pass_0, pass_1, pass_2, pass_3, password_0, password_1, password_2, password_3) {
new correct, pass[4], password[4], string[5] = "XXXX", number[4];
pass[0] = pass_0, pass[1] = pass_1, pass[2] = pass_2, pass[3] = pass_3;
password[0] = password_0, password[1] = password_1, password[2] = password_2, password[3] = password_3;
for(new i; i < 4; i) {
if(password[i] == pass[i]) {
strdel(string, i, i);
format(number, sizeof number, "%d", pass[i]);
strins(string, number, i);
correct;
}
}
printf("Output: %s (Correct: %i)\n", string, correct);
return correct;
}