Dear all,

I am in the process of writting a hospital/doctor prog. I have the majority working. BUT the program will only work ONCE.

when I run the prog and input patient details (No.1), the details are inputed correctly.

when I choose (No.5) I am able to correctly input the Doctor Details.

When I choose to print out these details to screen it works.

the prog will work only ONCE.

when I run the prog it will throw back some of the previous results even though I have inputed new details.

Here is the kicker. If I rename the .h files it will work again but only the once before i'm back to where I started.

ANY ANY ANY ADVICE HELP WOULD BE GREATLY APPRECIATED.

I HAVE TRYED TO COMPLIE ON 2 SEPERATE PROGS BUT THE SAME ERROR KEEPS COMMING BACK.

I HAVE ATTACHED THE FILE. U ONLY NEED CONCERN YOURSELF WITH OPTIONS 1,5,11, & 12.

MANY THANKS ,TIM

Sorry, I can't view your file (this stupid computer doesn't have WinZIP!), but I'm going to guess you're not clearing the keyboard buffer.

This will clear the keyboard buffer (it's in C):

int c;
while((c = getchar()) != '\n' && c != EOF);

Unfortunately that is not the solution. Can anybody else throw some light on the situation. I'm really under pressure.

mant thanks, tim

Well what do you mean by running only once? I compiled and ran the program, and it ran okay. I added two patients, one doctor and printed the patient and doctor list, all by one go at the program. The other options didnt work as I think you have to implemented them.

must be the complier i'm using. when I go to use the program and choose the option to print out doctor details (no 12) it prints out "test 3" even though I have it commented out. Does it print out "test 3" for you??? thanks for trying to complie the code.

I ran your compiled program and yes it outputs test3. I compiled myself and ran again, but there was no test3 output. The closest I can think of is that you are modifying one source file but compiling another.

I ran your compiled program and yes it outputs test3. I compiled myself and ran again, but there was no test3 output. The closest I can think of is that you are modifying one source file but compiling another.

This wouldn't surprise me either as for example you have more than one .h file with the same function:
int main_menu() ( in menu.h and displayMenu.h)

yes i have int main_menu() declared in my main.cpp and I cleaned up my code by placing all my functions in (displayMenu.h) As i dont have a main.h I am still a little lost. thx tim

As i dont have a main.h I am still a little lost. thx tim

Sorry, displayMenu.h and menu.h

Edited 3 Years Ago by Dani: Formatting fixed

Sorry, displayMenu.h and menu.h

I can't see a menu.h file either. the only header files i can see are doctors.h, linkedlist.h, patient.h, & displayMenu.h.

This question has already been answered. Start a new discussion instead.