Create a structure to specify the data for customers in a bank. The data to be stored is: Account number, Name, Balance in account. Assume a maximum of 200 customers in the bank.
struct CustomerData {
int acNum;
float balance;
char name[];
} n[2];
void main() {
for(int i = 0;i<2; i++) {
printf("give Ac. no. of %d customer\n",i+1);
scanf("%d",&n[i].acNum);
printf("balance of customer %d\n",i+1);
scanf("%f",&n[i].balance);
printf("Name of customer %d\n",i+1);
fflush(stdin);
gets(n[i].name);
}
printf(" Name Acc. no Balance \n");
for(int i =0;i<2;i++) {
printf("%c %d %f\n",puts(n[i].name),n[i].acNum,n[i].balance);
}
}
Output:
give Ac. no. of 1 customer
50054
balance of customer 1
11316
Name of customer 1
sahil
give Ac. no. of 2 customer
15655
balance of customer 2
100
Name of customer 2
Rishav
Name Acc. no Balance
'=
50054 11316.000000
Rishav
15655 100.000000
Process returned 34 (0x22) execution time : 25.120 s
Press any key to continue.