Auto-increment number

Hello,

This code is for (hospital management system). SEE NEXT REPLY

This code allow you to add patients.

There are two types of patients. which is:
1. Normal patient.
2. Critically ill patient.

once you added any patient. You will be able to show all patient using "ShowAllPatient;" method. -> i want the Auto-increment ID Number to appear for each patient has been added.

And you will be able to call a patient to provide a hospital services for him/her using "GetNextPatient;" method.


I need to generate an Auto-increment Number for each (patient) has been added. (Auto-increment Number) but it just should be different for each patient. For example the first patient will have 1, The second patient will have 2. etc. The Auto-increment number should appear for each patient.


Note:
This program is asking for entering ID.
So i don't want the program to ask for ID anymore
just create an Auto-increment number for each patient
So first patient has been added ID=1
second patient has been added ID=2
etc.

Thanks
Thank you
Last edited on
This program is asking for entering ID.
So i don't want the program to ask for ID anymore
just create an Auto-increment number for each patient
So first patient has been added ID=1
second patient has been added ID=2


So, don't ask for an ID any more and change it to do what you said.
So, don't ask for an ID any more

i can do that

and change it to do what you said.

How? i couldn't do it.
1
2
3
4
5
6
int ID=0; // global variable for ID-s

int patientID()
{
     return ++ID;
     }

will this do the trick?
closed account (DSLq5Di1)
What viliml suggested (implemented within the class),
http://ideone.com/4mwOg
Topic archived. No new replies allowed.