Slip no : 4_2 write a prog
to accept and display customer info. write a function to print the account no
and name of customer with balance beow 100(using structure) */




#include<conio.h>
#include<stdio.h>
struct customer
struct customer
{
int ano;
char
name[20]; int bal;
}c[10];
void
accept(struct customer ct[],int n)
{
int i;
for(i=0;i<n;i++)
for(i=0;i<n;i++)
{
printf("\n
Enter Account no : ");
scanf("%d",&ct[i].ano);
scanf("%d",&ct[i].ano);
printf("\n
Enter name of customer : ");
scanf("%s",ct[i].name);
scanf("%s",ct[i].name);
printf("\n
Enter balance : ");
scanf("%d",&ct[i].bal);
scanf("%d",&ct[i].bal);
}
}
void
display(struct customer ct[],int n)
{
int i;
printf("\nAno\tname\tBalance\n");
for(i=0;i<n;i++)
printf("\nAno\tname\tBalance\n");
for(i=0;i<n;i++)
{
printf("\n%d\t%s\t%d",ct[i].ano,ct[i].name,ct[i].bal);
printf("\n%d\t%s\t%d",ct[i].ano,ct[i].name,ct[i].bal);
}
}
void
display_cust(struct customer ct[],int n)
{
int i;
printf("\nAccount
no \t\tname\n");
for(i=0;i<n;i++)
for(i=0;i<n;i++)
{ if(ct[i].bal<100)
printf("\n%d\t\t%s",ct[i].ano,ct[i].name);
printf("\n%d\t\t%s",ct[i].ano,ct[i].name);
}
}
void main()
{
int no,ch;
clrscr();
clrscr();

{
printf("\n 1.create Account\n 2.display \n 3.Name of customer below 100 balance \n
0.exit");
printf("\n
Enter your choice : "); scanf("%d",&ch);
switch(ch)
{
case 1:
printf("\n
Enter how many Customers "); scanf("%d",&no);
accept(c,no);
break;
case 2:
display(c,no);
break;
case 3: display_cust(c,no); break;
case 0: break;
default: printf("\n Inavlid
choice ");
}
}while(ch!=0);
getch();
}
No comments:
Post a Comment