Пример #1
0
void createaccount(list *l) {

    int choice, acc;
    node *add, *check, *p;
    int i, main_exit;
    add = (node *)malloc(sizeof(node));


    printf("\n\n\n\t\t\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2 ADD RECORD \xB2\xB2\xB2\xB2\xB2\xB2\xB2\n");
    printf("Enter today's date(dd/mm/yyyy):\n");
    scanf("%d/%d/%d",&add->deposit.day,&add->deposit.month,&add->deposit.year);
    printf(" Enter the account number:\n");
    scanf("%d", &acc);
    check = l->head;
    if(l->tail == NULL) {
        check = NULL;
    }
    while(check != NULL) {
        if (acc == check->acc_no) {
            printf("Account no. already in use!\n");
            fordelay(1000000000);
            createaccount(l);
            break;
        }

        check = check->next;
    }
    add->acc_no = acc;
    printf("Enter account holder name:\n");
    scanf("%s",add->name);
    printf("Enter the age of account holder\n");
    scanf("%d",&add->age);
    printf("Enter the address\n");
    scanf("%s",add->address);
    printf("Enter date of birth\n");
    scanf("%d/%d/%d",&add->dob.day,&add->dob.month,&add->dob.year);
    printf("Enter the citizenship\n");
    scanf("%s", add->citizenship);
    printf("Enter phone no\n");
    scanf("%lf", &add->phone);
    printf("\nType of account:\n\t#Saving\n\t#Current\n\t#Fixed1(for 1 year)\n\t#Fixed2(for 2 years)\n\t#Fixed3(for 3 years)\n\n\tEnter your choice:");
    scanf("%s",add->acc_type);
    printf("Enter the amount\n");
    scanf("%f",&add->amt);

    if(l->head) {
        add->next = NULL;
        add->prev = l->tail;
        l->tail->next = add;
        printf("***************");
    }
    else {
        add->next = add->prev = NULL;
        l->head	= add;

    }
    l->tail = add;
    l->length++;
    if(l->length == 1)
        p = l->head = add;

    printf("Account created successfully\n\n\n");

    printf("\n\n\t\tEnter 1 to go to the main menu and 0 to exit:");
    scanf("%d",&main_exit);
    if (main_exit == 1) {

        menuchoice();
    }
    else if(main_exit == 0) {
        close();
    }
    else {
        printf("\nInvalid!\a");
    }

}
Пример #2
0
 void showadminmenu()
 {
  delay(250);
  cleardevice();
  hidemouseptr();
  border();

  settextjustify(1,1);
  settextstyle(3,0,5);
  setcolor(GREEN);
  outtextxy(290,80,"M A I N  M E N U");
  setcolor(WHITE);
  rectangle(210,155,450,185);
  rectangle(210,205,450,235);
  rectangle(210,255,450,285);
  rectangle(210,305,450,335);
  rectangle(210,355,450,385);
  rectangle(210,405,450,435);
  setfillstyle(1,LIGHTGRAY);
  for(i=0;i<=5;i++)
	floodfill(212,157+50*i,WHITE);
  for(i=0;i<=5;i++)
   {
	setcolor(DARKGRAY);
	line(210,185+50*i,450,185+50*i);
	line(450,155+50*i,450,185+50*i);
   }
  settextjustify(LEFT_TEXT,TOP_TEXT);
  settextstyle(3,0,1);
  setcolor(WHITE);
  outtextxy(225,155,"Create New Account");
  outtextxy(230,205,"Change Password");
  outtextxy(230,255,"Remove Account");
  outtextxy(225,305,"Transactions Enquiry");
  outtextxy(230,355,"List of Accounts");
  outtextxy(290,405,"Exit");

  showmouseptr();
  while(1)
  {
   showmouseptr();
   getmousepos(&button,&corx,&cory);
   if((button&1)==1)
   {
	if((corx>210&&corx<450)&&(cory>155&&cory<185))
	   {
	       hidemouseptr();
	       createaccount();
	       return;
	   }
	if((corx>210&&corx<450)&&(cory>205&&cory<235))
	   {
		   hidemouseptr();
		   delay(250);
		   while(!changepassword());
		   return;
	   }
	if((corx>210&&corx<450)&&(cory>255&&cory<285))
	   {
		   hidemouseptr();
		   delay(250);
		   rem_account();
		   return;
	   }
	if((corx>210&&corx<450)&&(cory>305&&cory<335))
	   {
		   hidemouseptr();
		   show_transactions();
		   return;
	   }
	if((corx>210&&corx<450)&&(cory>355&&cory<385))
	 {
		   hidemouseptr();
		   list_of_accounts();
		   return;
	 }
	if((corx>210&&corx<450)&&(cory>405&&cory<435))
	   {
		 hidemouseptr();
		 closegraph();
		 exit(0);
	   }
   }
  }
 }