Thread: compairing rates

  1. #1
    Unregistered
    Guest

    compairing rates

    I am currently writing a program for a class in which you open two files and after getting the info you calculate the divorce rate for 97,98,99 for severaly counties. Once you do that you have to compare the divorce rates and get the three highest and the three lowest. My question is how would I set it up to compare the rates and print out the three highest with the three lowest.

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    use a pencil and paper to write out how you are going to read in the data. Presumably you will be given information such as county name, count population, and number of divorces in count for each given year. Use the information directly from file if you think you can handle that, or store it in container of some sort. Either way, calculate divorce rates by county by year, if it's not already available in that format. For each year compare each counties rate by the previous high and low rate. If the current county is higher or lower than the current high or low replace the current high/low by the current. Once you have done a given year, or after evaluating all three years, print out the pertinent part of the report.

    If you are familiar with struct/classes they may be useful to you. If you are familiar with multi-dimensional arrays they could be used if you wish. You could also use several different "linked" arrays (element 0 always refers to a given county, element b to another, etc).

    Once you have it all figured out on paper, then try writing up some code.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. changing interrupt rates
    By rexnprogress in forum C Programming
    Replies: 6
    Last Post: 02-16-2011, 11:10 AM
  2. Monitor Refresh Rates
    By SlyMaelstrom in forum Tech Board
    Replies: 4
    Last Post: 05-24-2006, 01:08 PM
  3. Pay Rates Software Engineers
    By xddxogm3 in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 06-13-2005, 11:01 AM
  4. Human Metabolic Rates etc.
    By Waldo2k2 in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-20-2002, 09:53 PM
  5. compairing files
    By rkjd2 in forum C++ Programming
    Replies: 4
    Last Post: 09-09-2001, 02:10 PM