language: CLIPS (clips 6.24)
date: 222 days 0 hours ago
link:
visibility: public
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
#include <stdio.h>
 
const char STOREDPWD_STRING[16] = "p@ssword";
 
int main ()
{
   char USERINPUT_STRING[16]; 
   bool TEST_BOOL = 0;
        
   while (TEST_BOOL == 0) {
      printf ("Input password then hit <Enter>.  Enter <Q> to quit.\n");
      gets (USERINPUT_STRING);
      printf ("You input was: %s.\n", USERINPUT_STRING);
            
      if (USERINPUT_STRING == "Q") {
      TEST_BOOL = 1; 
      printf ("Goodbye!");
      } /* Close if */
      
      if (STOREDPWD_STRING == USERINPUT_STRING and TEST_BOOL == 0) {
      printf ("Password match, access granted!  Hello, Mr. Bond.");
      TEST_BOOL = 1; 
      /* In a real program, we'd do something here like pass to a higher function */
      } /* Close if */
      
      if (STOREDPWD_STRING != USERINPUT_STRING and TEST_BOOL == 0) {
      printf ("Password does not match, access denied!");
      } /* Close if */
 
   } /* Close while */
 
   return 0;
} /* Close Main */