Please re-write the fixing at my code , and make the fixing in Red Color to see
ID: 3661315 • Letter: P
Question
Please re-write the fixing at my code , and make the fixing in Red Color to see what you did
Not True and Cold Answer will take 1 Star and Report , I need real Answer .
The code :
#include<stdio.h>
#include<conio.h>
#define size 50
#include<stdlib.h>
void add();
void print(struct custamer);
int search(int person[].ID);
void sort(struct custamer);
void delet();
void pay();
int choice,choice2,counter=0;
float ca,nmr,af;
char an;
struct custamer
{
char name[30],name2[20];
int ID;
float cmr=0,tfd=0;
} person[50];
void main()
{
do
{
clrscr();
printf("------------------Main Menu-----------------");
printf(" 1- Add New client ");
printf(" 2- Manage Clients ");
printf(" 3- View All Clients ");
printf(" 4- View All Clients for specific Branch ");
printf(" 5- Sort Clients ");
printf(" 6- Exit ");
printf("---------------------------------------------");
printf("Enter your choice [ ]");
scanf("%d",&choice);
switch(choice)
{
case 1:int i;
do { printf("Enter Unique Client ID: ");
scanf("%d",&person[i].ID);
for (i=0;i<50;++i)
if (person[i].ID==person[i])
printf("Error!! The entered ID already exists");
} while(person[i].ID==person[i]);
add();
printf("New Client has been Added Successfully");
break;
case 2:clrscr();
do
{
printf("****************** Sub Menu ****************");
printf(" 1- Search Clients ");
printf(" 2- Delete Client ");
printf(" 3- Updata Meter Reading ");
printf(" 4- Pay Finanial Dues ");
printf(" 5- Return Back to Main Menu ");
printf("********************************************");
printf("Enter your choice [ ]");
scanf("%d",&choice2);
switch(choice2)
{
case 1:printf("Enter client ID to search: ");
scanf("%d",&person[].ID);
int resalt=search(ID);
break;
case 2:delet();
printf("The Client is deleted");
break;
case 3:printf("Enter Your Sub Menu Choise[ ] ");
scanf("%d",&choice2);
do {printf("Enter Meter Reading: ");
scanf("%d",&nmr);
} while(nmr<cmr);
printf(" The new meter reading= %d",nmr);
printf(" The current meter reading= %f",cmr);
ca=nmr-cmr;
af=ca*2;
printf(" The Consumed Amount= %d",ca);
printf(" The Additional Financial Dues= %d$",af);
up();
break;
case 4:printf("Enter Your Sub Menu Choise[ ] ");
scanf("%d",&choice2);
printf("Enter client ID: ");
scanf("%d",&id);
pay();
break;
case 5:printf("Redirecting you to Main Menu");
if(choice2==5)
break;
while(choice2==5);
case 3:clrscr();
print(struct custamer);
break;
case 4:printf("Enter Branch:");
search(struct custamer);
break;
case 5:sort(struct custamer);
printf("The sort process is completed");
break;
case 6:printf("Thank you for using our program....");
exit(0);
}
}
while(1);
}
void add()
{
for (int i=0;i<50;++i)
{ if (counter<50)
printf("Enter Clint Name[%d]:",i+1);
scanf("%s",&person[i].name);
strcpy(person[counter],name)
printf("Enter Clint Branch[%d]:",i+1);
scanf("%s",&person[i].name2);
strcpy(person[counter],name2)
counter++;
}
}
void print(struct custamer)
{
for (int i=0;i<50;++i)
{if(person[i].ID==0)
{printf("Client ID | Client Name | Client branch | Mater Reading | Financial Dues");
printf(" --------------------------------------------------------------------------------");
printf("%d %s %s %f %f ",person[i].ID,person[i].name,person[i].name2
,person[i].cmr,person[i].tfd);}
}
}
void search()
{
int i,x,flay=0;
printf("Enter ID to find:");
scanf("%d",&x);
for (i=0,i<50,++i)
if(person[i].ID ==x)
{flay =1;
break;}
if (flay ==1)
printf("%d is found",x);
else
printf("%d is not found",x);
}
void sort(struct custamer)
{
int i,j,struct custamer temp;
for (i=0;i<50;++i)
for (j=i+1;i<50;++j)
if (person[i].tfd>=person[i].tfd)
{
temp=person[i];
person[i]=person[j];
person[j]=temp;
}
printf("The sort process is completed");
getch();
}
int search(int person.ID)
{ for (int j=0;j<counter;++j)
{ if (person[i].ID==id)
return j;
}
return -1;
printf(" Client ID | Client Name | Client Branch | Meter Reading | Financial Dues");
printf("--------------------------------------------------------------------------");
printf("%d %s %s %f %f ",person[i].ID,person[i].name,person[i].name2
,person[i].cmr,person[i].tfd)
}
void delet()
{
int i,x;
printf(" Enter ID to delet : ");
scanf("%d",&x);
for (i=0;i<50;++i)
if (person[i].ID==x)
{person[i].ID=0;
person[i].name=" ";
person[i].name2" ";
person[i].cmr=0;
person[i].tfd=0;
}
}
void up()
{ for (int j=0;j<counter;++j)
if (person[].ID==person[j])
{ strcoy(person[j].cmr,nmr);
strcpy(person[j].tfd,af);
printf(" The current meter reading= %f",person[j].cmr);
printf(" The current Financial Dues= %f$",person[j].tfd);
}
}
void pay()
{ int p;
int pos=search(int person.ID);
if (pos!=-1)
for (int j=pos;j<counter;++j)
do { printf(" The current Financial Dues= %f$",person[j].tfd);
do {printf(" Enter payment Amount: ");
scanf("%d",&p);
} while(p<2 || p>=person[j].tfd);
printf(" The payment Amount= %d$",p);
person[j].tfd-=p;
printf(" The current Financial Dues= %f$",person[j].tfd);
printf(" Do you want to pay more? ");
scanf("%s",&an);
} while(an='y' || an='Y');
}
Explanation / Answer
Faulting application name: KillerTray.exe, version: 1.0.0.1, time stamp: 0x4b509abe Faulting module name: KillerTray.exe, version: 1.0.0.1, time stamp: 0x4b509abe Exception code: 0x40000015 Fault offset: 0x000000000004014e Faulting process id: 0x163c Faulting application start time: 0x01cd7fe3fc0142c2 Faulting application path: C:Program FilesBigfoot NetworksKiller DriverKillerTray.exe Faulting module path: C:Program FilesBigfoot NetworksKiller DriverKillerTray.exe Report Id: 5ae98194-ebd7-11e1-9c3b-00221930e440 apparently this is causing the runtime error Therefore net import of $1 million.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.