C++ Homework Assignment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kaloshi
    New Member
    • Nov 2006
    • 6

    C++ Homework Assignment

    Write the C++ code to declare (use typedef where possible):
    a. three one-dimensional arrays called: force1, force2 and force3 each with at most 30 components and each of base type float.

    the answer I got is:

    const int MAX_SIZE 30,
    typefef int LIST_I

    ??????? is that correct???
    The other problem is:
    Write the C++ code to declare (use typedef where possible):

    b. a list of course titles with at most 40 components.
  • kaloshi
    New Member
    • Nov 2006
    • 6

    #2
    Hello can someone please help with this C++ assingment

    Write the C++ code to declare (use typedef where possible):
    a. three one-dimensional arrays called: force1, force2 and force3 each with at most 30 components and each of base type float.

    the answer I got is:

    const int MAX_SIZE 30,
    typefef int LIST_I

    ??????? is that correct???
    The other problem is:
    Write the C++ code to declare (use typedef where possible):

    b. a list of course titles with at most 40 components.

    --------------------------------------------------------------------------------

    Reply

    Comment

    • willakawill
      Top Contributor
      • Oct 2006
      • 1646

      #3
      Originally posted by kaloshi
      Write the C++ code to declare (use typedef where possible):
      a. three one-dimensional arrays called: force1, force2 and force3 each with at most 30 components and each of base type float.

      the answer I got is:

      const int MAX_SIZE 30,
      typefef int LIST_I

      ??????? is that correct???
      The other problem is:
      Write the C++ code to declare (use typedef where possible):

      b. a list of course titles with at most 40 components.
      Hi. Use the typedef to define the array and then declare three instances of it:

      Code:
      typedef float farray[MAX_SIZE];
      
      farray ar1;
      farray ar2;
      farray ar3;

      Comment

      • kaloshi
        New Member
        • Nov 2006
        • 6

        #4
        One more question about arrays please help!

        write the C++ code to declare (use typedef where possible):

        1. a one-dimensional array of base type float called: weights with at most 25 components.


        2. a list of course titles with at most 40 components

        this is what I got for number 2.

        typedef STRING_15LIST_S 15[MAX_SIZE];

        If anyone could please help as soon as possible I would be very glad :)

        Comment

        • Banfa
          Recognized Expert Expert
          • Feb 2006
          • 9067

          #5
          Originally posted by kaloshi
          const int MAX_SIZE 30,
          It's a variable, it needs an = to be initialised and to end with a ; so
          const int MAX_SIZE = 30;

          Originally posted by kaloshi
          typefef int LIST_I
          your questions asks for a base type of float not int, also this is not a list it is a single item of type int. You need to use an array.

          Comment

          Working...