Thread: Assigning a number to a patient then displayed when called upon.

  1. #1
    Registered User
    Join Date
    Aug 2019
    Posts
    7

    Exclamation Assigning a number to a patient then displayed when called upon.

    What is the best solution for this task below?

    I want to know how to assign a number to a patient then when i entered that number the patients name will show up. i am also struggling to include firs and last name>




    Prompt the user to select one of the following options:


    1. Patient Details //Assume we will have maximum 15 patients
    2. Allocate Patient to Doctor //Jerome Mcclain, Teresita Lieu, Rocky Michael
    3. Call Patient //Call the next patient and send them to see their Dcotor
    4. Report //Generate a clinic financial report







    For 1 (Patient Details):
    Full Name: //First Name Last Name, max 25 characters
    // show full name to user
    Medicare Card Number: //5 digits entered, show digits to user
    //Receive the digits as a string of 5 characters
    Symptoms: //Comma separated list of symptoms
    // max 25 characters, show symptoms to user
    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





    /*Store the entered information into appropriate variables*/



    For 2 (Allocate Patient to Doctor):
    Doctor: //User selects one of the 3 doctors by connecting


    Patient Number: //user enters the patient number,
    //display the patient name, put
    //patient number in the list for the selected
    //doctor
    For 3 (Call Patient):



    Doctor: //User selects one of the 3 doctors


    //show the name of selected Doctor to user





    Patient to Be Called: // Show the name of the next patient waiting to
    //see the doctor selected.











    For 4 (Report):
    Show:




    Jerome Mcclain:
    Show the total earning of this doctor for the patients in their list (seen, currently
    with, or waiting), each patient fee for this doctor is $50

    Teresita Lieu:
    Show the total earning of this doctor for the patients in their list (seen, currently
    with, or waiting), each patient fee for this doctor is $60





    Rocky Michael:
    Show the total earning of this doctor for the patients in their list (seen, currently
    with, or waiting), each patient fee for this doctor is $40





    Total Clinic Income:
    Show the total clinic income

    What is the best solution for this task below?
    I want to know how to assign a number to a patient then when i entered that number the patients name will show up. i am also struggling to include firs and last name>
    Do i create a list to do this or an array?
    I need some direction to get things started!!


    Prompt the user to select one of the following options:
    1. Patient Details //Assume we will have maximum 15 patients
    2. Allocate Patient to Doctor //Jerome Mcclain, Teresita Lieu, Rocky Michael
    3. Call Patient //Call the next patient and send them to see their Dcotor
    4. Report //Generate a clinic financial report
    For 1 (Patient Details):
    Full Name: //First Name Last Name, max 25 characters
    // show full name to user
    Medicare Card Number: //5 digits entered, show digits to user
    //Receive the digits as a string of 5 characters
    Symptoms: //Comma separated list of symptoms
    // max 25 characters, show symptoms to user
    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
    /*Store the entered information into appropriate variables*/
    For 2 (Allocate Patient to Doctor):
    Doctor: //User selects one of the 3 doctors by connecting
    Patient Number: //user enters the patient number,
    //display the patient name, put
    //patient number in the list for the selected
    //doctor
    For 3 (Call Patient):
    Doctor: //User selects one of the 3 doctors
    //show the name of selected Doctor to user
    Patient to Be Called: // Show the name of the next patient waiting to
    //see the doctor selected.
    For 4 (Report):
    Show:
    Jerome Mcclain:
    Show the total earning of this doctor for the patients in their list (seen, currently
    with, or waiting), each patient fee for this doctor is $50
    Teresita Lieu:
    Show the total earning of this doctor for the patients in their list (seen, currently
    with, or waiting), each patient fee for this doctor is $60
    Rocky Michael:
    Show the total earning of this doctor for the patients in their list (seen, currently
    with, or waiting), each patient fee for this doctor is $40
    Total Clinic Income:
    Show the total clinic income

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I merged your posts.
    FYI, it's better to reply to your own thread with new information that start a new thread for every single thought you have.

    A good place to start would be to declare a struct to store a patient record, and create an array of that structure.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    338
    The simplest solution is to store the data in a delimited text file.

    i.e:
    Code:
       0001;first name;last name;phone;other;
       0002;name;last;phone;more information;
    Import the file and parse the text.
    Some information for how to do this...
    parsing - Read .CSV file in C - Stack Overflow

    Every time you create a "record" you generate the next number in the index field of the record...

    0001... 0002...
    Code:
        0003;new;last name;000;none;

    Delimiter-separated values - Wikipedia

  4. #4
    Registered User
    Join Date
    Feb 2019
    Posts
    1,078
    This is an student exercise or an actual system? A "real" database or a "fake" one?

    You can do it, as @Structure suggested using a text file with delimiters and parsing, or with an actual database (MariaDB, PostgreSQL, SQLLite etc) or a non-relational one (gdbm, for exemple).

  5. #5
    Registered User
    Join Date
    Aug 2019
    Posts
    7
    Thanks for that =, first time on here and learning to write c.

    Okay, great i will try that.

  6. #6
    Registered User
    Join Date
    Aug 2019
    Posts
    7
    This is a student exercise, thank you

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Assigning an array with a variable number of elements
    By LadyInRed in forum C Programming
    Replies: 3
    Last Post: 07-19-2014, 01:04 AM
  2. Patient Structure Program - Help?
    By Help_me0318 in forum C++ Programming
    Replies: 3
    Last Post: 10-18-2006, 03:00 PM
  3. Assigning negative number to unsigned variables.
    By sar_mahesh in forum C Programming
    Replies: 10
    Last Post: 09-27-2006, 05:47 PM
  4. Incrementing a number each time a function is called.
    By Coder87C in forum C++ Programming
    Replies: 17
    Last Post: 01-31-2005, 07:04 PM
  5. assigning a rand number to each element in an array
    By agerealm in forum C++ Programming
    Replies: 3
    Last Post: 12-15-2002, 01:12 PM

Tags for this Thread