Thread: Trying to do this on my own need some questions answered

  1. #1
    Registered User
    Join Date
    Dec 2004

    Trying to do this on my own need some questions answered

    I got this from a website it is a studyguide but im not sure on how to do these can someone help.

    Write a code snippet that will use a two-dimensional array of type integer to
    produce a multiplication table, where the contents of each cell will be the
    product of its two subscripts. The array will have 10 rows and 10 columns. Fill
    the array by ROW.

    Write a function called reverseArray that will be passed an array of type integer and its
    size. The function will reverse the order of the elements in the array IN PLACE as
    discussed in class. Any other method will not receive full credit. The function will
    display the array in its original form, then after the reversal process, display the array in
    the reversed form . Nothing is passed back to main.

    Declare a record data type called cds. Include the following fields in the structure and
    their data types:
    ?? CDName – string - 20 characters maximum
    ?? Artist - string - 20 characters maximum
    ?? RunTimeHrs - integer
    ?? RunTimeMin - integer
    ?? RunTimeSec - integer
    ?? CostOfCD - float (real)…make sure that there are only TWO numbers to the right of
    the decimal point

    Declare an instance of an array variable called MyCDs. The array will contain 15
    elements of data type cds as described in the question above.

    Write a function called CalculateTotalRunTime that will calculate and output the total
    running time of the cds in the array in hours, minutes and seconds. Note the following:
    ?? Assume that the function will be passed the array MyCDs and its size
    ?? Assume that the total running time will be displayed from inside the function
    ?? Make sure that you provide an appropriate output statement.
    ?? Nothing is returned from the array to the main algorithm
    ?? Select the appropriate passing method

    Use the BubbleSort function provided in your text to COMPLETELY trace the sort of an
    array of elements of type integer called List. The initial list of array elements is given
    below. Include ALL variables and expressions in your trace
    and show the state of the array at the end of each pass.
    Initial State of List: 16, 12, 11, 5, 18, 1

  2. #2
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    #1: You got all of those questions from a "study guide?"
    #2: Do you have any code demonstrating your attempts to fulfill the requirements of the "study guide" thus far?
    #3: Do you really think that you can go anywhere and post a list of "study guide" questions and just have people do them for you?
    #4: If it is truly a study guide (or if it is actually homework as I suspect) what kind of studying would someone else giving you all the answers provide? Try to do them yourself and return with questions when you run into problems.

  3. #3
    Registered User
    Join Date
    Dec 2004
    It is not my homework im trying to get a general idea on how to solve these as in not in a class.

  4. #4
    Registered User
    Join Date
    Mar 2002
    For arrays where exact requirements are known at compile time you may declare them statically. For two dimensional arrays you would use syntax like this:

    type arrayName[ROW][COL];

    where ROW and COL are constants. ROW can be thought of as representing the number of rows and COL can be thought of as representing the number of columns. Each pair of (ROW, COL) represents a single element of the array. The value of ROW and COL for a given element can be used to access the value stored by that element. You may then initialize or assign a value to that element as well as retrieve the current value of the the element by indicating the (ROW, COL) pair of the element like this:

    array[x][y] = input;

    result = array[x][y] + array[x + 1][y];

    The value of x will range from 0 to ROW - 1 and the value of y will range from 0 to COL - 1. Given the repetitive nature of manipulations of array elements, loops are commonly used. With two dimensional arrays, nested loops with the external loop controlling which row (or which x in the above examples) and the inner loop controlling which column ( or which y in the above examples) you wish to reference. If you want to add everything in a given row, then you lop through a each column of the row. If you want to add everything in a given column, then you loop through every row in the column.

    Bubble sorts are a common technique to sort arrays. The topic is readily searchable using the search feature of this board, or one of the other boards of this site. I would encourage you to access information that way or do a search using your favorite search engine.

    Once you start to write the pseudocode/code please post specific questions/problems you might encounter.

  5. #5
    Hardware Engineer
    Join Date
    Sep 2001

    Lightbulb Some general suggestions -

    1. Find another tutorial/study guide. In this case, a "code snippet" is worthless. You can't run a snippet, so you'll never know if it was right! When you see a published code snippet, it has (hopefully) been stripped-out of a working program. If you are going to use this study guide, then you should write a complete program to test-out the code. If you are totally lost and don't know where to start with this "assignment", then put it aside for now, and find a beginning tutorial.

    There is a tutorial here at, and another at

    2. Get a book. Most online tutorials seem to be very limited. Any good beginning C++ book will have much more information. For example, Teach Yourself C++ in 21 Days by Jesse Liberty is about 750 pages. Accelerated C++ by Koenig & Moo is about 350 pages.

    I'm not saying that the information doesn't exist on the Internet. It's just not well structured or organized for self-study. Lot's of us here are also learning on our own, but most of us have some books.

    3. To avoid negative responses here at, please read the Forum Guidelines and the code-tags message.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 08:47 AM
  2. Replies: 35
    Last Post: 01-31-2008, 06:01 PM
  3. Need Questions Answered Please
    By Zorroman1100 in forum Game Programming
    Replies: 3
    Last Post: 08-04-2007, 04:19 PM
  4. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  5. Trivial questions - what to do?
    By Aerie in forum A Brief History of
    Replies: 23
    Last Post: 12-26-2004, 09:44 AM