Advertisement
Guest User

Untitled

a guest
May 15th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.85 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <string.h>
  3. #include <conio.h>
  4. #include <iostream.h>
  5. #include <stdio.h>
  6. #include <windows.h>
  7. void setcolor(unsigned short color)
  8. {
  9. HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);
  10. SetConsoleTextAttribute(hCon,color);
  11. }
  12.  
  13.  
  14. main()
  15. {
  16. system ("title Tugas Kelompok 7 Struktur Data");
  17. char lagi;
  18. int indeks,test,r,username,password,ex;
  19. float x;
  20. int q[1000];
  21. int tugasss[4]=
  22. {1,2,3,4};
  23. char tugass[7] =
  24. {'A','M','I','K','B','S','I'};
  25. float tugas[7]=
  26. {1.3,2,3.3,4,5.7,8,9.9};
  27.  
  28.  
  29. cout << "--------------------------------------------------------------------------------";
  30. cout << "=============| Pogram untuk membaca input password dari user |==================";
  31. cout << "--------------------------------------------------------------------------------";
  32. int user = 123;
  33. int pass = 123;
  34. ex = 1;
  35. do {
  36. cout <<"\n";
  37. cout << "Username : ";
  38. cin >> username;
  39. cout << "Password : ";
  40. cin >> password;
  41. cout <<"\n";
  42. if (username == user && password == pass) {
  43. cout << "============================ \n";
  44. cout << "Anda Berhasil Login" << endl;
  45. cout << "============================ \n\n";
  46. } else
  47. {
  48.  
  49. cout << "\n====================================\n";
  50. cout << "Maaf USERNAME & PASSWORD ANDA Salah!" << endl;
  51. cout << "====================================\n\n";
  52. ex = ex +1;
  53. }
  54. }
  55. while (ex <= 3);
  56. cout << "Anda Telah 3x Memasukan ID & PASSWORD Yang Salah\n";
  57. cout << "Mohon Maaf kesempatan Anda hanya 3x ";
  58.  
  59.  
  60.  
  61. setcolor(11);
  62. cout<<endl;
  63. char a[]={"\tWELCOME TO ONE DIMENSIONAL ARRAY PROGRAM\n"};
  64. char b[]={"\t\t PRESENT BY GROUP 7\n"};
  65. int i;
  66. double j;
  67. for(i=0;a[i]!='\0';i++){
  68. printf("%c",a[i]);
  69. for(j=0;j<=19999999;j++){
  70. }
  71. }
  72. for(i=0;b[i]!='\0';i++){
  73. printf("%c",b[i]);
  74. for(j=0;j<=19999999;j++){
  75. }
  76. }
  77.  
  78. cout<<endl;
  79. cout<<endl;
  80. setcolor(10);
  81. char c[]={"\t\t12151111\tARDIANSYAH\n"};
  82. for(i=0;c[i]!='\0';i++){
  83. printf("%c",c[i]);
  84. for(j=0;j<=19999999;j++){
  85. }
  86. }
  87. cout<<endl;
  88. char d[]={"\t\t12151111\tFIKI\n"};
  89. for(i=0;d[i]!='\0';i++){
  90. printf("%c",d[i]);
  91. for(j=0;j<=19999999;j++){
  92. }
  93. }
  94. cout<<endl;
  95. char e[]={"\t\t12153528\tJAMALUDIN\n"};
  96. for(i=0;e[i]!='\0';i++){
  97. printf("%c",e[i]);
  98. for(j=0;j<=19999999;j++){
  99. }
  100. }
  101. cout<<endl;
  102. char f[]={"\t\t12151692\tANISA SAFITRI\n"};
  103. for(i=0;f[i]!='\0';i++){
  104. printf("%c",f[i]);
  105. for(j=0;j<=19999999;j++){
  106. }
  107. }
  108. cout<<endl;
  109. char g[]={"\t\t12150854\tSALWA SRI DUNYA\n"};
  110. for(i=0;g[i]!='\0';i++){
  111. printf("%c",g[i]);
  112. for(j=0;j<=19999999;j++){
  113. }
  114. }
  115.  
  116.  
  117. clrscr();
  118.  
  119. //deklarasi string x
  120. setcolor(27);
  121. char k[]="PLEASE WAIT...PROGRAM IS BEING STARTED!!!";
  122. //deklarasi variabel bertipe integer
  123. int l,m,n;
  124.  
  125. //perulangan 5x untuk memunculkan string x sebanyak 5x
  126. for(n=0; n<5; n++)
  127. {
  128. //clear screen
  129. system("cls");
  130. //perulangan untuk menimbulkan jeda waktu
  131. for(l=0; l<199999;l++)
  132. {
  133. for(m=0; m<1999; m++)
  134. {
  135. }
  136. }
  137. //mencetak string k
  138. printf("\n\n%s",k);
  139. //perulangan untuk menimbulkan jeda waktu
  140. for(l=0; l<199999;l++)
  141. {
  142. for(m=0; m<1999; m++){
  143. }
  144. }
  145. }
  146.  
  147. mulai:
  148. clrscr();
  149. cout<<endl;
  150. setcolor(12);
  151. cout<<"\t SELAMAT DATANG \n";
  152. cout<<"\t MENU ARRAY DIMENSI SATU \n";
  153. cout<<"\t KELOMPOK TUJUH \n";
  154. cout<<endl;
  155. setcolor(11);
  156. cout<<"\t1. Inisialisasi Array Part I \n";
  157. cout<<"\t2. Inisialisasi Array Part II \n";
  158. cout<<"\t3. Inisialisasi Array Part III \n";
  159. cout<<"\t4. Inisialisasi Array Part IV \n";
  160. cout<<"\t5. Keluar \n";
  161. cout<<endl;
  162. setcolor(9);
  163. cout<<"\tMasukan Program Yang di Pilih [1,2,3,4] = ";cin>>test;
  164. switch(test)
  165. {
  166.  
  167. case 1:
  168. clrscr();
  169. {
  170. cout<<endl;
  171. setcolor(12);
  172. cout<<"\tInisialisasi Array Part I"<<endl;
  173. cout<<endl;
  174. setcolor(11);
  175. for (char t = 0; t < 7; t++)
  176. {
  177. cout<<"\tElemen Array Ke ["<<(t+1)<<"] = "<<tugass[t]<<endl;
  178. }
  179. cout<<endl;
  180. cout<<"\tPlease Enter To Continue...";
  181. getch();
  182. clrscr();
  183. cout<<endl;
  184. setcolor(9);
  185. cout<<"\tIngin Input Lagi[Y/T] : ";
  186. cin>>lagi;
  187. if(lagi=='Y' ||lagi=='y')
  188. goto mulai;
  189. break;
  190. }
  191.  
  192.  
  193. case 2:
  194. clrscr( );
  195. {
  196. cout<<endl;
  197. setcolor(12);
  198. cout<<"\tInisialisasi Array Part II "<<endl;
  199. cout<<endl;
  200. setcolor(11);
  201. for (int t = 0; t < 4; t++)
  202. {
  203. cout<<"\tElemen Array ke ["<<(t+1)<<"] = "<<tugasss[t]<<endl;
  204. }
  205. tugasss[0]=7;
  206. tugasss[1]=8;
  207. tugasss[2]=9;
  208. tugasss[3]=10;
  209. cout<<endl;
  210. cout<<"\tInisialisasi Aray Yang Baru :"<<endl;
  211. cout<<endl;
  212. for (int t = 0; t < 4; t++)
  213. {
  214. cout<<"\tElemen Array Ke ["<<(t+1)<<"] = "<<tugasss[t]<<endl;
  215. }
  216. cout<<endl;
  217. cout<<"\tPlease Enter To Continue...";
  218. getch();
  219. clrscr();
  220. cout<<endl;
  221. setcolor(9);
  222. cout<<"\tIngin Input Lagi[Y/T] : ";
  223. cin>>lagi;
  224. if(lagi=='Y' ||lagi=='y')
  225. goto mulai;
  226. break;
  227. }
  228.  
  229. case 3:
  230. clrscr();
  231. {
  232. cout<<endl;
  233. setcolor(12);
  234. cout<<"\tInisialisasi Array Part III"<<endl;
  235. cout<<endl;
  236. setcolor(11);
  237. for(r=0;r<5;r++)
  238. {
  239. cout<<"\tMasukkan Elemen Array ["<<(r+1)<<"] = ";cin>>q[r];
  240. }
  241. cout<<endl;
  242. cout<<"\tElemen Array Yang Telah di Input : "<<endl;
  243. for(r=0;r<5;r++)
  244. {
  245. cout<<"\tElemen Array Ke ["<<(r+1)<<"] = "<<q[r]<<endl;
  246. }
  247. cout<<endl;
  248. cout<<"\tPlease Enter To Continue...";
  249. getch();
  250. clrscr();
  251. cout<<endl;
  252. setcolor(9);
  253. cout<<"\tIngin Input Lagi[Y/T] : ";
  254. cin>>lagi;
  255. if(lagi=='Y' ||lagi=='y')
  256. goto mulai;
  257. break;
  258. }
  259.  
  260. case 4:
  261. clrscr();
  262. {
  263. cout<<endl;
  264. setcolor(12);
  265. cout<<"\tInisialisasi Array Part IV "<<endl;
  266. cout<<endl;
  267. setcolor(11);
  268. for (int t = 0; t < 7; t++)
  269. {
  270. cout<<"\tElemen Array Ke ["<<(t+1)<<"] = "<<tugas[t]<<endl;
  271. }
  272. cout<<endl;
  273. setcolor(10);
  274. cout<<"\tMasukkan Indeks Yang Akan di Ganti : ";
  275. cin>>indeks;
  276. cout<<"\tMasukan Nilai Yang Akan di Ganti : ";
  277. cin>>x;
  278. tugas[indeks]=x;
  279. cout<<endl;
  280. setcolor(12);
  281. cout<<"\tNilai Array Yang Baru : "<<endl;
  282. cout<<endl;
  283. setcolor(11);
  284. for (int t = 0; t < 7; t++)
  285. {
  286. cout<<"\tElemen Array Ke ["<<(t+1)<<"] = "<<tugas[t]<<endl;
  287. }
  288. cout<<endl;
  289. cout<<"\tPlease Enter To Continue...";
  290. getch();
  291. clrscr();
  292. cout<<endl;
  293. setcolor(9);
  294. cout<<"\tIngin Input Lagi[Y/T] : ";
  295. cin>>lagi;
  296. if(lagi=='Y' ||lagi=='y')
  297. goto mulai;
  298. break;
  299. }
  300.  
  301. case 5:
  302. clrscr();
  303. {
  304. cout<<endl;
  305. setcolor(11);
  306. char a[]={"\tTHANKYOU FOR YOUR ATTENTION\n"};
  307. char b[]={"\t\tGOOD BYE\n"};
  308. int i;
  309. double j;
  310. for(i=0;a[i]!='\0';i++){
  311. printf("%c",a[i]);
  312. for(j=0;j<=19999999;j++){
  313. }
  314. }
  315. for(i=0;b[i]!='\0';i++){
  316. printf("%c",b[i]);
  317. for(j=0;j<=19999999;j++){
  318. }
  319. }
  320. cout<<endl;
  321. cout<<endl;
  322. cout<<"\tPlease Enter To Continue...";
  323. break;
  324. }
  325.  
  326. default:
  327. clrscr();
  328. {
  329. cout<<endl;
  330. setcolor(11);
  331. cout<<"\tMenu Tidak Tersedia Harap Pilih Yang Benar !!!";
  332. getch();
  333. goto mulai;
  334. }
  335.  
  336. }
  337.  
  338. getch();
  339. return 0;
  340. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement