Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Other Programming (https://www.askmehelpdesk.com/forumdisplay.php?f=437)
-   -   Modular progams (pseudo-code algorithm) (https://www.askmehelpdesk.com/showthread.php?t=236722)

  • Jul 12, 2008, 03:48 PM
    nova2177
    modular progams (pseudo-code algorithm)
    how do you extract a module from a pseudo-code algorithm.
    I'm not sure if I can post the question here but here goes.

    a) write an algorithm that will display the sum for a given numbers of squares, e.g. if the user enter the value 3, then the output should be 1² + 2² + 3² = 14
    b) from (a) use a module called sumsquare that will accept an integer value and return the sum of the squares of the value entered
    c) use the sumsquare module to write an algorithm that will perform the same function as (a)

    I think I figured out (a) but I have never done modules, I only know what it is. If some one can help me out, please help, show me an example of some sort, doesn't have to be the question that I post.
    thanks.
  • Jul 12, 2008, 04:48 PM
    KISS
    This is how I interpret the question.

    a) Is just plain pseudocode

    b) Basically means something that will use "include sumsquare.c"
    In sumsquare.c is a function sumsquare[x].

    c) in pseudocode
    main.c
    input x
    print sumsquare (x)
    end main

    sumsquare.c
    function sumsquare(x)
    return sum of squares (x)
    end sumsquare.c

    My c is very rusty.

    Basically your creating two programs of source code.

    Does this make sense?

  • All times are GMT -7. The time now is 07:33 PM.