Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- #include<string.h>
- #include<windows.h>
- typedef char string[50];
- void main()
- {
- int menu,sLogin=0,sFalse=0,ID1,ID2,ID3;
- string uName,pass,name1,name2,name3,npm1, npm2, npm3;
- do
- {
- system("CLS");
- printf("\n\t\t----UNIVERSITAS W----");
- printf("\n\t\t|1|. Logiin");
- printf("\n\t\t|2|. Input");
- printf("\n\t\t|3|. Tampil");
- printf("\n\t\tuntuk nyoba --> username: megan/josephine ; pass: 3107/2909");
- printf("\n\t\t--> Get Input: ");scanf("%d",&menu);
- switch(menu)
- {
- case 1:
- {
- do
- {
- if(sFalse<=3)
- {
- printf("\n\t\tUsernama\t: ");fflush(stdin);gets(uName);
- printf("\n\t\tPassword\t: ");fflush(stdin);gets(pass);
- if(strcmpi(uName,"Josephine")!=0 && strcmpi(pass,"2909")!=0 && strcmpi(uName,"Megan")!=0 && strcmpi(pass,"3107")!=0)
- {
- printf("\n\n\t\tUsername dan Password Salah!!\n\t\tSilahkan input ulang!!!");
- sFalse=sFalse+1;
- }
- else
- {
- printf("\n\t\tBerhasil Login!!");
- sLogin=1;
- }
- }
- else if(sFalse>3)
- {
- printf("\n\t\tGagal Login!!");
- sFalse=0;
- break;
- }
- }while(strcmpi(uName,"Josephine")!=0 && strcmpi(pass,"2909")!=0 && strcmpi(uName,"Megan")!=0 && strcmpi(pass,"3107")!=0);
- }
- getch();
- break;
- case 2:
- {
- if(sLogin==1)
- {
- do {
- printf("\n\t\tID: ");
- scanf("%d",&ID1);
- }while(ID1%3!=0);
- printf("\n\t\tInput Your Name\t: ");fflush(stdin);gets(name1);
- do
- {
- printf("\n\t\tNPM\t\t: ");fflush(stdin);gets(npm1);
- if(strlen(npm1)!=9)
- {
- printf("\n\t\tNPM harus 9 Digit!!\n");
- }
- }while(strlen(npm1)!=9);
- do {
- printf("\n\t\tID: ");
- scanf("%d",&ID2);
- }while(ID2%3!=0);
- printf("\n\t\tInput Your Name\t: ");fflush(stdin);gets(name2);
- do
- {
- printf("\n\t\tNPM\t\t: ");fflush(stdin);gets(npm2);
- if(strlen(npm2)!=9)
- {
- printf("\n\t\tNPM harus 9 Digit!!");
- }
- }while(strlen(npm2)!=9);
- do {
- printf("\n\t\tID: ");
- scanf("%d",&ID3);
- }while(ID3%3!=0);
- printf("\n\t\tInput Your Name\t: ");fflush(stdin);gets(name3);
- do
- {
- printf("\n\t\tNPM\t\t: ");fflush(stdin);gets(npm3);
- if(strlen(npm3)!=9)
- {
- printf("\n\t\tNPM harus 9 Digit!!");
- }
- }while(strlen(npm3)!=9);
- printf("\n\t\tBerhasil Diinputkan!!");
- }
- else{
- printf("\n\t\tLogin Terlebih Dahulu!!!");
- }
- }break;
- case 3: if(sLogin==1)
- {
- printf("\n\t\t====MENU TAMPIL====");
- printf("\n\t\tID\t: %d",ID1);
- printf("\n\t\tNama\t: %s",name1);
- printf("\n\t\tNPM\t: %s",npm1);
- printf("\n\t\tID\t: %d",ID2);
- printf("\n\t\tNama\t: %s",name2);
- printf("\n\t\tNPM\t: %s",npm2);
- printf("\n\t\tID\t: %d",ID3);
- printf("\n\t\tNama\t: %s",name3);
- printf("\n\t\tNPM\t: %s",npm3);
- }
- getch();
- break;
- }
- getch();
- }while(menu!=0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement