Roger
2011-04-16 15:29:15 UTC
# include
# include
# include
# include
#include
#define MAX_LENGTH 100
char firstname[MAX_LENGTH]; /* store the Patient's Name*/
char last_name[MAX_LENGTH]; /* store the Patient's Last Name*/
char nurse_name[MAX_LENGTH]; /*Stores the nurse's Name*/
int age; /* store the Patient's age*/
int option; /*variable to stores the user's option in the menu*/
char appt; /* store the whether the patient has an appointment or not*/
char health_card; /* store whether the patient has a health card or not*/
float cost; /* store the Fees to be charged to the patient*/
int valid_input;
main()
{
system ("color B4");
system("cls");
printf("\t\t\t\t Norman Gardens Health Center\n\n");
printf("\t\t\t\t\tFEES CALCULATION\n\n");
/* Prompt the Nurse/user to enter the patient's First Name and read the value entered*/
printf("Patient First Name: ");
scanf("%s", &firstname);
/* Prompt the Nurse/user to enter the patient's Last Name and read the value entered*/
printf("\nPatient Last Name: ");
scanf("%s", &last_name);
/* Prompt the Nurse/user to enter the patient's age and read the value entered*/
printf("\nPatient Age: ");
scanf("%d", &age);
/* Prompt the Nurse/user to enter the patient's age and read the value entered*/
valid_input = 0;
while( valid_input == 0 ) {
printf("\nDoes the Patient have a Health Card? (Y/N): ");
scanf(" %s", &health_card );
health_card = toupper( health_card );
if((health_card == 'Y') || (health_card == 'N') ) valid_input = 1; /*Validates the User's Input*/
else printf("\n\n\007ERROR: INVALID OPTION\n\n");
}
/* Prompt the Nurse/user to enter the patient's age and read the value entered*/
valid_input = 0;
while( valid_input == 0 ) {
printf("\nDoes the Patient have an appointment? (Y/N): ");
scanf(" %s", &appt );
appt = toupper( appt ); /*Converts the user's input to Capital if it isnt*/
if((appt == 'Y') || (appt == 'N') ) valid_input = 1;
else printf("\n\n\007ERROR: INVALID OPTION\n\n");
}
if(appt = "Y") ERROR MESSAGE IN COMPILER:[Warning] assignment makes integer from pointer without a cast
{
if(age > 60)
{
if(health_card = "Y")
{
cost = 80-(80*70%)
}
else{
cost = 99
}
}
printf("%d", cost);
}
getch();
}
The program worked fine until i inserted the IF statement!! Can u tell me whats wrong. th