non-modular to modular program conversion

This is a discussion on non-modular to modular program conversion within the C Programming forums, part of the General Programming Boards category; /*kenf: split from: http://cboard.cprogramming.com/showthread.php?t=52351 */ Sorry guys for grave digging this topic but I've also come across this question and ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Location
    Western Australia
    Posts
    1

    need help!

    /*kenf: split from: Need help with some C programs. (VERY Long Post) */

    Sorry guys for grave digging this topic but I've also come across this question and I am completely stuck not to mention at my wits end.

    I have designed a non-modular program which denotes the change correctly however I am having trouble converting this program to modular.

    Would appreciate any assistance.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Make a new topic, don't bump old threads. Link to the old thread if you need to, as a point of reference.
    Read the forum guidelines. You'll see handy tips like "post your code", and use code tags.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,506
    > however I am having trouble converting this program to modular.
    Grab a pad of post-it notes or 5x3 library cards, and write on each one a subject your program deals with.

    Expand each one with a description of what needs to be done.

    If you can't fit all the information on one card, then write a summary line which refers to another card which has more room on it to describe a more specific step.

    Eventually, the "leaf" cards will contain very detailed descriptions of a small part of the program, and this is what you implement.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Would appreciate any assistance.
    Think about it from a functional point of view. Maybe something like:

    1) Give a greeting, and get their input amount of money.
    2) Calculate the change and print that out
    3) Ask them if they want to input another amount.
    4) Say Good bye if they're done

    I didn't read that whole former post because life is too short, and the thread and your program seemed WAY too long. imo.

    C is a concise programming language. Try to make your programs the same. Nested while loops will take care of all your giving change logic. There's no need imo for "fifty" and "quarters", and "dimes", and "nickels", and "pennies". Just cents will do for most things.

    Can you BRIEFLY specify the requirements of this assignment, in one, two, three, format?
    1) ....
    2) ....
    3) ....

    This is not (so far, I don't have all the specifics yet of your assignment), a difficult problem. Let's keep it as simple as we practically, can.

    (and use code tags for any code), it's just annoying and a time-waster, otherwise.

    Adak

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Conversion Help
    By magda3227 in forum C Programming
    Replies: 6
    Last Post: 06-13-2008, 01:24 PM
  2. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 06:49 PM
  3. Decimal to Binary Conversion program
    By acidbeat311 in forum C Programming
    Replies: 5
    Last Post: 01-12-2006, 09:26 PM
  4. question about the loop in case conversion program
    By Elhaz in forum C++ Programming
    Replies: 8
    Last Post: 09-20-2004, 04:06 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

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