Thread: Health record program

  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
    4,632
    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
    505
    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.
    https://github.com/MalcolmMcLean


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, 04: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, 06:50 AM