Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- #include<windows.h>
- #include<string.h>
- typedef char string[50];
- void main()
- {
- char menu;
- string user,pass,nama,alamat,ptemp,ptemp2;
- int umur,i,j;
- float tab=0,temp;
- do
- {
- system("CLS");
- printf(" Bank COINS \n");
- printf("=====================\n");
- printf(" 1. Buat Account\n");
- printf(" 2. Isi Tabungan\n");
- printf(" 3. Show Account\n");
- printf(" 4. Edit Password\n");
- printf("---------------------\n");
- printf(" press ESQ to Escape\n");
- printf("=====================\n\n");
- menu=getch();
- switch(menu)
- {
- case '1':
- printf("-----=====Add Account====---\n");
- printf("Username : ");fflush(stdin);gets(user);
- do{
- printf("Password : ");fflush(stdin);gets(pass);
- if(strlen(pass)<4)
- {
- printf("Password minimal 4 digit '-'\n\n");
- }
- }while(strlen(pass)<4);
- printf("Nama : ");fflush(stdin);gets(nama);
- printf("Umur : ");scanf("%d",&umur);
- printf("Alamat : ");fflush(stdin);gets(alamat);
- printf("\nAccount berhasil dibuat! ^^\n");
- break;
- case '2':
- j=0;
- printf("---====Tambah Tabungan====---\n");
- printf("Username : %s\n",user);
- do{
- printf("Password : ");fflush(stdin);gets(ptemp);
- if(strcmp(ptemp,pass)!=0)
- {
- printf("Password salah! '-' \n\n");
- j++;
- }
- else if(j==3)
- {
- break;
- }
- }while(strcmp(ptemp,pass)!=0 && j<3);
- if(j==3)
- {
- printf("Account dikunci oleh pihak bank untuk keamanan! '-' \n\n");
- strcpy(pass,"Coins123");
- }
- else
- {
- printf("\nMasukkan jumlah uang : ");scanf("%f",&temp);
- tab=tab+temp;
- printf("Uang berhasil dimasukkan ke dalam Tabungan ^^\n");
- }
- break;
- case '3':
- printf("---====Data Account====---\n");
- printf("Username : %s\n",user);
- printf("Nama : %s\n",nama);
- printf("Umur : %d\n",umur);
- printf("Alamat : %s\n",alamat);
- printf("Jumlah Tabungan: Rp%.2f\n",tab);
- break;
- case '4':
- i=0;
- printf("---====Edit Password====---\n");
- printf("Username : %s\n",user);
- do{
- j=0;
- do{
- printf("Password Lama : ");fflush(stdin);gets(ptemp);
- if(strcmp(ptemp,pass)!=0)
- {
- printf("Password salah! '-'\n\n");
- j++;
- }
- }while(strcmp(ptemp,pass)!=0 && j!=3);
- if(strcmp(ptemp,pass)!=0 && j==3)
- {
- printf("Edit password gagal! '-' \n\n");
- break;
- }
- else
- {
- do{
- printf("Password Baru : ");fflush(stdin);gets(ptemp);
- if(strlen(ptemp)<4)
- {
- printf("Password minimal 4 digit '-'\n\n");
- }
- }while(strlen(ptemp)<4);
- printf("Verifikasi password baru : ");fflush(stdin);gets(ptemp2);
- if(strcmp(ptemp,ptemp2)!=0)
- {
- printf("Password tidak cocok! '-'\n\n");
- i++;
- }
- else
- {
- strcpy(pass,ptemp2);
- printf("Password berhasil diganti! ^^\n\n");
- }
- }
- }while(strcmp(ptemp,ptemp2)!=0 && i<3);
- break;
- }
- if(menu==27)
- {
- printf("\n Terimakasih Telah\n");
- printf("Menabung di Bank Kami!\n");
- printf(" ^^\n\n");
- }
- getch();
- }while(menu!=27);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement