void doctorrecord(void)
{
system("color 2");
char Target[50];
int tell=0;
int Found=0,count1=0,count2=0,count3=0;
char doctor1[30],doctor2[30],doctor3[30];
int health=0,fees=0,collected=0;
strcpy(doctor1,"Dr.Robert.Willimas");
strcpy(doctor2,"Dr.James.Brown");
strcpy(doctor3,"Dr.John.Whyte");
if((customer1=fopen("transaction.txt","r"))==NULL)
printf("THE FILE IS EMPTY");
else
{
while(fscanf(customer1,"%s %s %s %s %s %d %d %d %d",det.name,det.regis,det.pname,det.treatment,det.piont,&det.fees,&det.collect,&det.insure,&det.balance)==9
&& Found==0)
{
//fscanf(customer1,"%s %s %s %s %s %d %d %d %d",det.name,det.regis,det.pname,det.treatment,det.piont,&det.fees,&det.collect,&det.insure,&det.balance);
if(strcmp(doctor1,det.name)==0)
{
{
count1++;
Found=1;
fees = det.fees + fees;
collected = det.collect + collected;
health = det.insure + health;
}
if(Found)
{
printf("\n\t\t NAME:%s",det.pname);
}
printf("\n\t\t NUMBER OF PATIENTS:%d",count1);
printf("\n\t\t TREATMENT:%s",det.treatment);
printf("\n\t\t TOTAL FEES ARE:$ %d",fees);
printf("\n\t\t TOTAL FEES COLLECTED:$ %d",collected);
printf("\n\t\t TOTAL HEALTH INSURANCE FEES:$ %d",health);
}
else if(strcmp(doctor2,det.name)==0)
{
{
count2++;
Found=1;
fees = det.fees + fees;
collected = det.collect + collected;
health = det.insure + health;
}
if(Found)
{
printf("\n\t\t NAME:%s",det.pname);
printf("\n\t\t NUMBER OF PATIENTS:%d",count);
printf("\n\t\t TREATMENT:%s",det.treatment);
printf("\n\t\t TOTAL FEES ARE:$ %d",fees);
printf("\n\t\t TOTAL FEES COLLECTED:$ %d",collected);
printf("\n\t\t TOTAL HEALTH INSURANCE FEES:$ %d",health);
}
}
else if(strcmp(doctor3,det.name)==0)
{
{
count3++;
Found=1;
fees = det.fees + fees;
collected = det.collect + collected;
health = det.insure + health;
}
if(Found)
{
printf("\n\t\t NAME:%s",det.pname);
printf("\n\t\t NUMBER OF PATIENTS:%d",count);
printf("\n\t\t TREATMENT:%s",det.treatment);
printf("\n\t\t TOTAL FEES ARE:$ %d",fees);
printf("\n\t\t TOTAL FEES COLLECTED:$ %d",collected);
printf("\n\t\t TOTAL HEALTH INSURANCE FEES:$ %d",health);
}
}
}
fclose(customer1);
}
}
Detect the error
Started by hbk, Mar 14 2010 09:48 AM
5 replies to this topic
#1
Posted 14 March 2010 - 09:48 AM
I am reading data from a file but i am then comparing it with a another data item but the compiler is not printing to screen what i ask it to.
|
|
|
#2
Posted 14 March 2010 - 10:50 AM
Without seeing the contents of both the file, and where it's not printing when you expect it to, we may not be able to help much.
#3
Posted 14 March 2010 - 11:14 AM
Dr.Robert.Williams 1 John.Grisam Cleaning 4/07/09 4500 3400 0 -1100
This is what the file looks like.
This is what the file looks like.
#4
Posted 14 March 2010 - 11:53 AM
Dr.Robert's family name in the code appears to be Willimas and not Williams. That is probably the problem - it doesn't match any case.
#5
Posted 14 March 2010 - 02:16 PM
That does'nt seem to be the answer
#6
Posted 14 March 2010 - 02:37 PM
In this case post your whole code.


Sign In
Create Account


Back to top









