#include<alloc.h>
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<dos.h>
#include<ctype.h>
typedef struct node
{
int dd,mm,yy;
int cus_ac_no[15];
char cus_name[25],cus_add[45],cus_ph_no[17];
double cus_bal;
float cus_intrst;
struct node *next;
}node;
node *L,*ptr;
void add()
{
node *p,*q,*new;
p=q=L;
clrscr();
new=(node*)malloc(sizeof(node));
if(new==NULL)
{
printf("list is full");
getch();
return;
}
else {
printf(" Enter customer account number : ");
scanf("%d",new->cus_ac_no);
printf(" Enter customer name : ");
gets(new->cus_name);
printf(" Enter customer address : ");
gets(new->cus_add);
printf(" Enter customer phone number :");
gets(new->cus_ph_no);
printf(" Enter the amount you want deposit :");
scanf("%lf",&new->cus_bal);
while(new->cus_ac_no > p->cus_ac_no && p!=NULL)
{
q=p;
p=p->next;
}
if(L!=NULL){
q->next=new;
new->next=p;
}
else{
L=new;
new->next=p;
}
}
}
void list()
{
node *ptr;
ptr=L;
while(ptr!=NULL);
{
gotoxy(8,2); printf("============================================\n");
gotoxy(8,3); printf("......Customer's Information .......");
gotoxy(8,4); printf("============================================\n");
gotoxy(7,7); printf("|-> Customer Account number is: %d",ptr->cus_ac_no);
gotoxy(7,10); printf("|-> Customer Name is: %s",ptr->cus_name);
gotoxy(7,13); printf("|-> Customer Address is: %s",ptr->cus_add);
gotoxy(7,16); printf("|->Customer Phone number is: %s",ptr->cus_ph_no);
gotoxy(7,19); printf("|-> Customer Balence is : %.3lf ",ptr->cus_bal);
gotoxy(7,22); printf("|->Account opened on :");
gotoxy(7,24); printf("<-->Press any key to continue");
ptr=ptr->next;
} getch();
}
void transac()
{
printf("trans..");
getch();
}
void del(int cus_ac_no)
{
node *p,*q;
p=q=L;
while(cus_ac_no!=p->cus_ac_no && p!=NULL)
{
q=p;
p=p->next;
}
if(p==NULL){
printf("record not found");
getch();
return;
}
else{
if(L==p)
L=p->next;
else
q->next=p->next;
free(p);
}
}
int menu()
{ int i,s=0;
do{
clrscr();
gotoxy(4,9); printf("1.-> Adding a new Account\n");
gotoxy(4,12); printf("2.-> List all Accounts\n");
gotoxy(4,15); printf("3.-> Transaction [Deposit/Withdraw]\n");
gotoxy(4,18); printf("4.-> Delete any \n");
gotoxy(4,21); printf("5.-> Exit \n");
gotoxy(4,29); printf("Enter your choice [1-5] :");
scanf("%d",&s);
}while(s<1 && s>5);
return(s);
}
main()
{
int i;
int cus_ac_no[15];
while(1){
i=menu();
switch(i)
{
case 1 :
clrscr();
add();
break;
case 2:
clrscr();
list();
break;
case 3:
clrscr();
transac();
break;
case 4 :
clrscr();
printf("enter accnt no. that u want 2 erase:");
scanf("%d",cus_ac_no);
for(i=0;i<45;i++);
while(cus_ac_no[i] > '0 ' && cus_ac_no[i] <'9')
cus_ac_no[i]=cus_ac_no[i];
del(cus_ac_no[45]);
break;
case 5:
clrscr();
printf("THANK YOU FOR USING THIS SOFTWARE");
getch();
exit(0);
break;
default :
clrscr();
gotoxy(5,3); printf(" SORRY WRONG CHOICE....");
gotoxy(5,5); printf(" PRESS ANY KEY TO CONTINUE....");
getch();
break;
}
}
}
comp_sci11
0
Light Poster
Recommended Answers
Jump to PostWhat is the problem? We don't have the time to run and debug your program. Narrow down the function that is wrong and post it. Post properly formatted code.
Jump to PostIt might sound harsh, but we're (at least, Me) are not interested in how urgent this is for you.
Next time you post please use proper English, punctuation etcetera. Also choosing a proper title would help a lot. The title you used doesn't give any information at all. You're …
All 5 Replies
WolfPack
491
Posting Virtuoso
Team Colleague
comp_sci11
0
Light Poster
Eddy Dean
13
Junior Poster in Training
Rashakil Fol
commented:
You're awesome.
+3
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
Salem
5,138
Posting Sage
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.