Hi all,
I am trying to write a code where i store patient name and a patient number. (i will be entering multiple names)
further on through the program i want to enter that number and it will display the name.
Here is what i have so far.
Code:
while(1)
{
printf("\nSelect one of the following numbers and press enter"); //Alerts user to selsct the following command.
printf("\n1.Patient Details"); //Assume we will have maximum 15 patients
printf("\n2.Allocate Patient to Doctor"); //prompts user to allocate dcotors to patients: Jerome Mcclain, Teresita Lieu, Rocky Michael (Doctors names)
printf("\n3.Call Patient"); //Call the nextpatient and send them to see their Doctor
printf("\n4.Report"); //Generates a clinic financial report
printf("\n----------------"); //prints newline
scanf("%d",&choice); //Stores users choice
switch (choice)
{
case 1:
{
printf ("\nEnter the following and press enter"); //Prompts user to enter the following details followed by enter key
printf ("\nFirst Name and last name"); //First Name Last Name, max 25characters, show full name to user
scanf ("%s %s",patientname[i].Firstname,patientname[i].Lastname); // First name stored and last name stored
printf ("\nFull name:%s %s", patientname[i].Firstname,patientname[i].Lastname); //Full name to be shown
printf ("\nMedicare Card Number:"); //5digits entered, show digits to user, Receive the digits as a string of 5characters
scanf("%s",patientname[i].cardnumber); // Medicare card number stored
printf("%s\n",patientname[i].cardnumber); // Medicare number shown
printf ("Symptoms:"); //Comma separated list of symptoms, max 25 characters, show symptoms to user
scanf ("%s", patientname[i].symptoms); // Symtoms for pateient stored
printf ("%s\n", patientname[i].symptoms);// Symtoms shown on screen
printf ("Patient Number:"); //Generate patient number and display it this number should be an integer equal to the number of patients currently in the system + 1
scanf ("%s",patientname[i].patientnumber); // Patient number stored
printf ("%s\n",patientname[i].patientnumber); // Patient number shown
}
break;
case 2:
{
printf ("\nSelect Doctor:\n For Jerome McClain connect Pin 8.\n For Teresita Lieu connect Pin 9.\n For Rocky Michael connect Pin 10."); // Tells user which pin is which for each doctor
if (~PINH & (1<<PH5)) //If Pin 8 is selcted
{
printf ("\nJerome McClain"); //Prints doctors name for pin 8
printf ("\nAssign Patient number to doctor:"); // Tells user to allcoate a patient to a doctor by means of there number
scanf ("%s",patientname[i].patientnumber); // Adds Patient number to doctor
printf ("%s",patientname[i].patientnumber); // Prints Patient number to screen
printf ("\nFull name:%s %s", patientname[i].Firstname, patientname[i].Lastname); //Prints patient name to screen
}