Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Windows.h>
- #include <conio.h>
- using namespace std;
- void gotoxy(int column, int line)
- {
- COORD coord;
- coord.X = column;
- coord.Y = line;
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord );
- }
- void loginmenu()
- {
- system("cls");
- gotoxy(30, 13); cout << "password: ";
- }
- void main()
- {
- int a;
- int dem = 0, sokitu;
- char pass[15];
- do
- {
- sokitu = 0;
- loginmenu();
- do
- {
- a = _getch();
- cout << "*";
- pass[sokitu] = a;
- sokitu++;
- } while (a != 13 && sokitu < 14);
- pass[sokitu - 1] = '\0'; //do nhận ký tự enter ở vòng lặp nên phải đè ký tự kết thúc vào ví trí enter
- if (strcmp(pass, "admin") == 0)
- {
- cout << "thanh cong" << endl;
- break;
- }
- dem++;
- } while (dem < 3);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement