बिजनेस मार्केटिंग का लो कॉस्ट फंडा , अपने मोबाइल से ऑटो sms भेजकर मार्केटिंग करे विजिट करे http://autotextsms.com/ बिजनेस मार्केटिंग का लो कॉस्ट फंडा http://autotextsms.com/

Search This Blog

Translate

c structure program to perform account operation deposit , withdraw check balance

c structure program to perform account operation deposit , withdraw  check balance

#include
#include
#define no 2

struct customer
{
  int accno;
  char accname[50];
  float bal;

};
typedef struct customer CUST;
CUST c[no];
void low_bal();
void transaction();
void show();
main()
{
  char ch;
  int i;
  clrscr();
  for(i=0;i  {
   printf("\n Enter the Account  no:");
   scanf("%d",&c[i].accno);
   printf("\n Enter Account Name:");
   fflush(stdin);
   gets(c[i].accname);
   printf("\n Enter the balance:");
   scanf("%f",&c[i].bal);
  }
  low_bal();
  printf("\n You want to perform transaction enter (y/n)");
  fflush(stdin);
  scanf("%c",&ch);
     if(ch=='y'||ch=='Y')
       transaction();
  show();
 getch();
 return 0;
}
void low_bal()
{ int i;
  for(i=0;i  {
   if(c[i].bal<=100)
    {
     printf("\n Account no:%d",c[i].accno);
     printf("\n Account Name:%s\n",c[i].accname);
    }
  }
}
void transaction()
{
 int i,ch,acno;
 float amt;
 printf("\n Enter 1:Deposite  0:Withdrawal ");
 scanf("%d",&ch);
 printf("\n Enter account no:");
 scanf("%d",&acno);
 for(i=0;i {
  if(acno==c[i].accno)
  {
    printf("\n Enter amount:");
    scanf("%f",&amt);
     if(ch==1)
      c[i].bal+=amt;
     else
      if(amt>c[i].bal)
      {
       printf("\n The balance is insufficient for specific withdrawal!");
       break;
      }
      else
    c[i].bal-=amt;
   }
 }
}
void show()
{
 int i;
 for(i=0;i {
  printf("\nAccount no:=%d\nAccount Name:=%s\nBalance:=%f\n",c[i].accno,c[i].accname,c[i].bal);
 }
}

C Program example List