Ask your own question, for FREE!
Computer Science 20 Online
OpenStudy (anonymous):

why ch must be equal to 13???

OpenStudy (anonymous):

#include <stdio.h> #include <stdlib.h> #include <conio.h> #include <string.h> int main(void) { int i,counter=0,flag=0; char uid[25],pwd[25],s_uid[][25]={"11user1","12user2","13user3"}; char s_pwd[][25]={"Pwd1","Pwd2","Pwd3"},ch='a'; printf("\n Enter the user id : "); scanf("%s",uid); printf("\n Enter the password : "); i=0; while(1) { ch=getch(); if(ch==13) break; else if(ch==8) { if(i!=0) { printf("\b"); printf("%c",32); printf("\b"); i--; pwd[i]='\0'; } else continue; } else { printf("*"); pwd[i]=ch; i++; } } pwd[i]='\0'; for(i=0;i<=2;i++) { if((stricmp(uid,s_uid[i]))==0 && (strcmp(pwd,s_pwd[i]))==0) { flag=1; break; } } getch(); }

OpenStudy (anonymous):

http://www.asciitable.com/ 13 is the carriage return (basically enter)

OpenStudy (rsmith6559):

Carriage returns alone are mostly used in Mac GUIs. Microsoft uses carriage return and line feed. Unix (and most of OSX) uses line feeds. Line feeds are ASCII and UTF-8 10 (decimal, 0x0a hexadecimal).

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!