[ create a new paste ] login | about

Link: http://codepad.org/LIFXRG6X    [ raw code | output | fork ]

C, pasted on Jan 18:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <string.h>

#define PASSWORD_SIZE 100
#define PASSWORD 	"MygOODpassword\n"

int main (){

int count = 0;
char buff[PASSWORD_SIZE];
for(;;){
	printf("Enter Enigma Key:");
	fgets(&buff[0], PASSWORD_SIZE, stdin);
	if (strcmp(&buff[0], PASSWORD))
		printf("Failed once again..\n");
	else break;

if (++count>3) return -1;
	}
printf("Password OK\n");
}


Output:
1
2
3
4
5
6
Enter Enigma Key:Failed once again..
Enter Enigma Key:Failed once again..
Enter Enigma Key:Failed once again..
Enter Enigma Key:Failed once again..

Exited: ExitFailure 255


Create a new paste based on this one


Comments: