Advertisement
Guest User

Untitled

a guest
Feb 4th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5.  
  6. using namespace std;
  7.  
  8. main()
  9. {
  10. int pilih;
  11. string user="";
  12. string pass="";
  13. char kl[20];
  14. int y;
  15. char p;
  16. char pt;
  17. char py;
  18. char username[20];
  19. char password[20];
  20. char kata[100];
  21. char pganti;
  22. char ganti;
  23. char kata_[10];
  24. int i;
  25. int jum=1;
  26. int plih;
  27.  
  28. cout<<"1.Register-------------------"<<endl;
  29. cout<<"2.Login----------------------"<<endl;
  30. cout<<"Ingin Register atau Login : ";
  31. cin>>plih;
  32. cout<<"-----------------------------"<<endl;
  33.  
  34. if(plih==1)
  35. {
  36. goto regis;
  37. }
  38. else if(plih==2)
  39. {
  40. goto log;
  41. }
  42. system("cls");
  43. regis:
  44. cout<<endl;
  45. cout<<"--Silahkan Register--"<<endl;
  46. cout<<"---------------------"<<endl;
  47. cout<<"Input Username : ";
  48. cin.sync();
  49. gets(username);
  50.  
  51. cout<<"Input Password : ";
  52. cin.sync();
  53. gets(password);
  54.  
  55. system("cls");
  56. log:
  57. cout<<"-------------------"<<endl;
  58. cout<<"Ingin Login (Y/T) : ";
  59. cin>>pt;
  60. cout<<"-------------------"<<endl;
  61.  
  62. if(pt=='Y' || pt=='y')
  63. {
  64. system("cls");
  65.  
  66. cout<<"--Menu Login---"<<endl;
  67. cout<<"---------------"<<endl;
  68. cout<<"Username : ";
  69. cin>>user;
  70. cout<<"Password : ";
  71. cin>>pass;
  72. cout<<"---------------"<<endl;
  73. system("cls");
  74. }
  75.  
  76. else if(pt=='T' || pt=='t')
  77. {
  78. exit(0);
  79. }
  80.  
  81. awal :
  82. system("cls");
  83. if(user==username && pass==password)
  84. {
  85. cout<<"--Menu Pilihan---"<<endl;
  86. cout<<"-----------------"<<endl;
  87. cout<<"-----By Nang-----"<<endl;
  88. cout<<"1.Input"<<endl;
  89. cout<<"2.Edit"<<endl;
  90. cout<<"3.Manipulasi"<<endl;
  91. cout<<"4.Exit"<<endl;
  92. cout<<"-----------------"<<endl;
  93. cout<<"Input Pilihan : ";
  94. cin>>pilih;
  95. cout<<"--------------------"<<endl;
  96.  
  97. switch(pilih)
  98. {
  99. case 1 :
  100. cout<<"Masukan Kalimat : ";
  101. cin.sync();
  102. gets(kata);
  103. break;
  104.  
  105. case 2 :
  106. cout<<"Kata awal : "<<kata<<endl;
  107.  
  108. cout<<"Input Kata yang Diganti : ";
  109. cin>>ganti;
  110.  
  111. cout<<"Input Pengganti Huruf : ";
  112. cin>>pganti;
  113.  
  114. for(i=1;i<strlen(kata);i++)
  115. {
  116. if(kata[i]==ganti)
  117. {
  118. kata[i]=pganti;
  119. }
  120. }
  121.  
  122. cout<<"Kata Akhir : "<<kata<<endl;
  123. break;
  124.  
  125. case 3 :
  126. if((kata[0]>='a') && (kata[0]<='z'))
  127. {
  128. kata[0]=kata[0]-32;
  129. }
  130. for(int i=0;i<strlen(kata);i++)
  131. {
  132. if((kata[jum]>='A') && (kata[jum]<='Z'))
  133. {
  134. kata[0]=kata[0]-32;
  135. }
  136. jum++;
  137. }
  138.  
  139. for(int j=1;kata[j]!=NULL;j++)
  140. {
  141. if(kata[j+1]==NULL || kata[j+1]==' ')
  142. {
  143. kata[j]='%';
  144. }
  145. if(kata[j]==' ')
  146. {
  147. kata[j]='_';
  148.  
  149. if(kata[j+1]>='a' && kata[j+1]<='z')
  150. {
  151. kata[j+1]=kata[j+1]-32;
  152. }
  153. }
  154. }
  155. cout<<"Hasil Kata : "<<kata;
  156.  
  157. case 4 :
  158. exit(0);
  159. break;
  160.  
  161. default :
  162. cout<<"Inputan Salah"<<endl;
  163. }
  164. }
  165. else
  166. {
  167. system("cls");
  168. cout<<"---------------------------"<<endl;
  169. cout<<"Salah Username dan Password"<<endl;
  170. cout<<"---------------------------"<<endl;
  171. }
  172.  
  173. cout<<"-------------------------------"<<endl;
  174. cout<<"Ingin Ulang ke Menu Utama (Y/T) : ";
  175. cin>>py;
  176. cout<<"-------------------------------"<<endl;
  177.  
  178. if(py=='Y' || py=='y')
  179. {
  180. goto awal;
  181. }
  182. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement