ºÝºÝߣ
Submit Search
includ
?
Download as DOCX, PDF
?
0 likes
?
285 views
Z
Zaend Zaend
Follow
C++
Read less
Read more
1 of 6
Download now
Download to read offline
More Related Content
includ
1.
#include <conio.h> #include <stdlib.h> #include
"screen.cpp" #define KEY_INT0x16 /* Nomorinterupsi keyboard*/ #define KEY_BACKSPACE0x08/* Tombol Backspace */ #define KEY_RETURN 0x0d /* Tombol Enter*/ #define KEY_TAB0x09 /* Tombol Tab */ #define KEY_SPACE0x20 /* Tombol spasi */ #define NULL0x00 /* ASCII0 */ #define TRUE 1 UCHAR *getString(Screen*scr,UCHAR*str, UCHAR max); UCHAR *getPwdString(Screen*scr,UCHAR*pwd,UCHAR max); int main(void) { Screen*layar = newScreen(); UCHAR *nama, nama2[16]; UCHAR *sandi,sandi2[21]; UCHAR *jenis,jenis2[2]; UCHAR kar = '*'; layar->setMode(0x03); layar->setCursorPos(2,15); layar->writeString("InputBiodataUser");
2.
layar->setCursorPos(3,9); layar->writeString("=============================="); layar->setCursorPos(5,9); layar->writeString("Nama :"); layar->setCursorPos(5,27); /* Memasukanusername
*/ nama = getString(layar,nama2,15); layar->setCursorPos(6,9); layar->writeString("Password :"); layar->setCursorPos(6,27); /* Memasukanpassword*/ sandi = getPwdString(layar,sandi2,20); layar->setCursorPos(7,9); layar->writeString("JenisKelamin:"); layar->setCursorPos(7,27); /* Memasukanjeniskelamin*/ nama = getString(layar,jenis2,1); clrscr(); layar->setCursorPos(2,15); layar->writeString("OutputBiodataUser"); layar->setCursorPos(3,9); layar->writeString("=============================="); layar->setCursorPos(5,9);
3.
layar->writeString("Nama : "); layar->setCursorPos(5,26); layar->writeString(nama2); layar->setCursorPos(6,9); layar->writeString("Password
:"); layar->setCursorPos(6,26); layar->writeString(sandi); layar->setCursorPos(7,9); layar->writeString("JenisKelamin:"); layar->setCursorPos(7,26); layar->writeString(jenis2); layar->setCursorPos(7,40); /* getKey*/ asm mov ah,0x00; asm intKEY_INT; delete layar;returnEXIT_SUCCESS; } UCHAR *getString(Screen*scr,UCHAR*str, UCHAR max) { UCHAR key,i,x, y; key= i = 0; while (TRUE) { asm mov ah,0x00; asm intKEY_INT; asm mov key,al;
4.
if ((key== KEY_BACKSPACE)
&&(i > 0)) { scr->getCursorPos(&y,&x); scr->setCursorPos(y, --x); scr->writeChar(KEY_SPACE); *(str + i) = NULL; i--; } if ((key>= 32) && (key<= 126) && (i < max)) { scr->getCursorPos(&y,&x); scr->writeChar(key); scr->setCursorPos(y,++x); *(str + i) = key;i++; } if ((key== KEY_TAB) && (i < max)) { scr->getCursorPos(&y,&x); scr->writeChar(KEY_SPACE); scr->setCursorPos(y,++x); *(str + i) = KEY_SPACE;i++; } if (key== KEY_RETURN) { *(str + i) = NULL;
5.
break; } if (i ==
max) *(str+ i) = NULL; } return str; } UCHAR *getPwdString(Screen*scr,UCHAR*pwd,UCHAR max) { UCHAR key,i,x, y; key= i = 0; while (TRUE) { asm mov ah,0x00; asm intKEY_INT; asm mov key,al; if ((key== KEY_BACKSPACE) &&(i > 0)) { scr->getCursorPos(&y,&x); scr->setCursorPos(y, --x); scr->writeChar(KEY_SPACE); *(pwd+ i) = NULL; i--; }
6.
if ((key>= 32)
&& (key<= 126) && (i < max)) { scr->getCursorPos(&y,&x); scr->writeChar('*'); scr->setCursorPos(y,++x); *(pwd+ i) = key;i++; } if ((key== KEY_TAB) && (i < max)) { scr->getCursorPos(&y,&x); scr->writeChar('*'); scr->setCursorPos(y,++x); *(pwd+ i) = KEY_TAB; i++; } if (key== KEY_RETURN) { *(pwd+ i) = NULL; break; } if (i == max) *(pwd+ i) = NULL; } return pwd; }
Download