Advertisement
Guest User

Untitled

a guest
Mar 13th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.09 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<string.h>
  4. #include<windows.h>
  5. typedef char string[50];
  6.  
  7. void main()
  8. {
  9. int menu,sLogin=0,sFalse=0,ID1,ID2,ID3;
  10. string uName,pass,name1,name2,name3,npm1, npm2, npm3;
  11.  
  12. do
  13. {
  14. system("CLS");
  15. printf("\n\t\t----UNIVERSITAS W----");
  16. printf("\n\t\t|1|. Logiin");
  17. printf("\n\t\t|2|. Input");
  18. printf("\n\t\t|3|. Tampil");
  19. printf("\n\t\tuntuk nyoba --> username: megan/josephine ; pass: 3107/2909");
  20. printf("\n\t\t--> Get Input: ");scanf("%d",&menu);
  21.  
  22. switch(menu)
  23. {
  24. case 1:
  25. {
  26.  
  27. do
  28. {
  29. if(sFalse<=3)
  30. {
  31. printf("\n\t\tUsernama\t: ");fflush(stdin);gets(uName);
  32. printf("\n\t\tPassword\t: ");fflush(stdin);gets(pass);
  33. if(strcmpi(uName,"Josephine")!=0 && strcmpi(pass,"2909")!=0 && strcmpi(uName,"Megan")!=0 && strcmpi(pass,"3107")!=0)
  34. {
  35. printf("\n\n\t\tUsername dan Password Salah!!\n\t\tSilahkan input ulang!!!");
  36. sFalse=sFalse+1;
  37. }
  38.  
  39. else
  40. {
  41. printf("\n\t\tBerhasil Login!!");
  42. sLogin=1;
  43. }
  44. }
  45. else if(sFalse>3)
  46. {
  47. printf("\n\t\tGagal Login!!");
  48. sFalse=0;
  49. break;
  50. }
  51. }while(strcmpi(uName,"Josephine")!=0 && strcmpi(pass,"2909")!=0 && strcmpi(uName,"Megan")!=0 && strcmpi(pass,"3107")!=0);
  52. }
  53. getch();
  54. break;
  55. case 2:
  56. {
  57. if(sLogin==1)
  58. {
  59. do {
  60. printf("\n\t\tID: ");
  61. scanf("%d",&ID1);
  62. }while(ID1%3!=0);
  63.  
  64. printf("\n\t\tInput Your Name\t: ");fflush(stdin);gets(name1);
  65. do
  66. {
  67. printf("\n\t\tNPM\t\t: ");fflush(stdin);gets(npm1);
  68. if(strlen(npm1)!=9)
  69. {
  70. printf("\n\t\tNPM harus 9 Digit!!\n");
  71. }
  72. }while(strlen(npm1)!=9);
  73.  
  74.  
  75. do {
  76. printf("\n\t\tID: ");
  77. scanf("%d",&ID2);
  78. }while(ID2%3!=0);
  79.  
  80. printf("\n\t\tInput Your Name\t: ");fflush(stdin);gets(name2);
  81. do
  82. {
  83. printf("\n\t\tNPM\t\t: ");fflush(stdin);gets(npm2);
  84. if(strlen(npm2)!=9)
  85. {
  86. printf("\n\t\tNPM harus 9 Digit!!");
  87. }
  88. }while(strlen(npm2)!=9);
  89.  
  90. do {
  91. printf("\n\t\tID: ");
  92. scanf("%d",&ID3);
  93. }while(ID3%3!=0);
  94.  
  95. printf("\n\t\tInput Your Name\t: ");fflush(stdin);gets(name3);
  96. do
  97. {
  98. printf("\n\t\tNPM\t\t: ");fflush(stdin);gets(npm3);
  99. if(strlen(npm3)!=9)
  100. {
  101. printf("\n\t\tNPM harus 9 Digit!!");
  102. }
  103. }while(strlen(npm3)!=9);
  104.  
  105. printf("\n\t\tBerhasil Diinputkan!!");
  106. }
  107. else{
  108. printf("\n\t\tLogin Terlebih Dahulu!!!");
  109. }
  110.  
  111. }break;
  112. case 3: if(sLogin==1)
  113. {
  114. printf("\n\t\t====MENU TAMPIL====");
  115.  
  116.  
  117. printf("\n\t\tID\t: %d",ID1);
  118. printf("\n\t\tNama\t: %s",name1);
  119. printf("\n\t\tNPM\t: %s",npm1);
  120.  
  121. printf("\n\t\tID\t: %d",ID2);
  122. printf("\n\t\tNama\t: %s",name2);
  123. printf("\n\t\tNPM\t: %s",npm2);
  124.  
  125. printf("\n\t\tID\t: %d",ID3);
  126. printf("\n\t\tNama\t: %s",name3);
  127. printf("\n\t\tNPM\t: %s",npm3);
  128.  
  129. }
  130. getch();
  131. break;
  132. }
  133. getch();
  134. }while(menu!=0);
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement