-
Notifications
You must be signed in to change notification settings - Fork 1
/
ITProject.c
80 lines (53 loc) · 2.23 KB
/
ITProject.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include<stdio.h>
#include<stdlib.h>
enum status{Pass,Fail};
int CrackThePassword(char pwd[]){
for(int i = 0; i < 7; i++){
if(pwd[i] == pwd[6-i]){
return 1;
}else{
return 0;
}
}
}
int main(){
enum status GameStatus;
int id;
char pwd[7];
printf("\n -----------------------------------Welcome to Treasure Hunt!!!----------------------------------- \n");
printf("\nRules : \n\n1. You have to retreive keys by solving variety to puzzles to proceed to further levels.\n");
printf("\n2. You will be given only three chances in each level to correcly determine and submit the keys. \n");
printf("\n3. If you complete all three levels only then you will win.\n");
printf("\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Best Of Luck!!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n");
printf("\nLevel 01 : Crack the password!\n");
printf("\nA Palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward");
printf(", such as racecar or 123454321 etc. \nThe word Palindrome was introduced by Henry Peachman in 1638. It is derived from the");
printf("Greek roots. The ancient Greek poet Sotades(3rd century BCE)\ninvented a form of ionic meter called as Sotadic or ");
printf("Sotadean verse, which is sometimes said to have been palindromic, but no exapmles survive,\nand the exact nature of");
printf("'reverse' readings is unclear.\n");
printf("\nEnter the user id (Institute Roll Number) : ");
scanf("%d",&id);
printf("\nEnter the password (it's 7 characters long) : ");
scanf("%s",pwd);
int count = 0;
while(count < 3){
if(CrackThePassword(pwd) == 1){
printf("\nVoila!!! You are on fire... Proceed to next level..");
GameStatus = Pass;
break;
}else{
printf("\nYou got %d tries left.", 2-count);
if(count != 2){
printf(" Give it another go : ");
scanf("%s",pwd);
}else{
printf(" Better Luck next time!!!");
GameStatus = Fail;
break;
}
}
count ++;
}
count = 0;
return 0;
}