#include
#include
int main(void) {
int length = 2;
int r,i;
int c;
srand((unsigned int)time(0)); //Seed number for rand()
for (i = 0; i < length; i++) {
r = rand() + 5;
c = (int)r;
printf("%d", c);
}
return 0;
}
--------------------
int Password::GETCH(void) {
return _getch(); // does not echo input
}
int Password::BreakPass() { //uses global var. password and ptr
char input;
int count;
count = 0;
printf("enter your password: ");
do
{
input = GETCH();
if(input == '\xD') break; // enter pressed?
putc('*', stdout);
ptr = &input;
password[count] = *ptr;
count++;
}while(count < 20);
password[count++] = '\0'; // terminate the string
printf("\nyour password: %s\n", password);
return 0;
}
No comments:
Post a Comment