Health record program

This is a discussion on Health record program within the C Programming forums, part of the General Programming Boards category; I am supposed to write a program that maintains health records such as body weight, age, and so on. I ...

  1. #1
    Registered User
    Join Date
    Feb 2013
    Posts
    1

    Health record program

    I am supposed to write a program that maintains health records such as body weight, age, and so on. I have already have the figures in and was just wondering how would I display them with printf & scanf. For example.

    Code:
    int computeAge(hp record);
    /* Purpose: This function computes the patients maximum heart rate   Inputs:  An integer that represents the patients age in years   Outputs: An integer that represents the patients maximum heart rate*/
    This is what I have so far.
    Code:
    #include <stdio.h>struct DOB
    {
        int month;
        int day;
        int year;
    };
    typedef DOB dob;
    
    
    struct healthprofile hp;
    {
        char * lName;
        char * fName;
        char gender; 
        dob birthDate;
        dob todaysdate;
        double height;
        double weight;
    };
    
    
    typedef struct healthProfile hp;
    
    
    
    
    void getprofileData(hp record);
    
    
    int computerAge(hp record);
    
    
    int computerMaxHR(int age);
    
    
    int computerTargetHR(int mhr);
    
    
    double computeBMI(hp record);
    
    
    void displayProfileData(hp record);
    
    
    void displayProfileStats(int age, int mhr, int thr, double b);
    
    
    int main()
    {
        int yearAge;
        int maxHR;
        int targetHR;
        double bmi;
        hp aProfile;
    
    
    
    
    
    
    
    
    
    
    
    
            return 0;
    }
    
    
    void getProfileData(hp record)
    {
    }
    
    
    int computeAge(hp record)
    {
        return 0;
    
    }
    I hope to get some advice on how I would complete this code.

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    2,698
    You may want to start with this tutorial: C Structures.

    Just remember main should be defined to return an int, not a void.


    Jim

  3. #3
    Registered User
    Join Date
    May 2012
    Posts
    333
    Start really simple. Just with the date.

    Write a function that displays a DOB. That should be quite easy, though you can make it really complicated if you wish, with options for American or European order, month names, and so on.

    Then write two functions, one which saves a date to a file, and one which loads the date you have just saved. Make it human-readable, text not binary. You'll find that the save is easy to write - essentially, just your display function. The load is a bit harder because you have to reject invalid dates -eg 30/2/2014, ugglewuggle, 1/1/4025 (you could argue about that last one).
    I'm the author of MiniBasic: How to write a script interpreter and Basic Algorithms
    Visit my website for lots of associated C programming resources.
    http://www.malcolmmclean.site11.com/www

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Student record program
    By mugiwara528 in forum C Programming
    Replies: 1
    Last Post: 03-14-2011, 06:27 PM
  2. Update Record & Delete Record in File.
    By unsafe_pilot1 in forum C Programming
    Replies: 13
    Last Post: 05-18-2008, 07:22 AM
  3. Need Help Making Program to Record Traffic Stats
    By Xell in forum C++ Programming
    Replies: 4
    Last Post: 11-05-2005, 03:39 PM
  4. How do you make your program record keystrokes
    By aaroroge in forum C++ Programming
    Replies: 1
    Last Post: 06-25-2005, 06:55 AM
  5. Program won't save a record
    By Delboy in forum C Programming
    Replies: 6
    Last Post: 02-10-2002, 05:50 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21