Study Guide 05.docx - 1 Write a definition statement that...

This preview shows page 1 out of 1 page.

1. Write a definition statement that defines a Car structure variable initialized with the following information: Make: Ford Year: 2010 Model: Mustang Cost: $22,495 car hotRod(“Ford”, “Mustang”, 2004, 25000.0); 2. Define the following arrays: A) empNum, a 100-element array of ints B) payRate, a 25-element array of doubles C) miles, a 14-element array of longs D) statecapital, a 50-element array of string objects. E) lightYears, a 1,000-element array of doubles int empNum[100]; double payRate[25]; long miles[14]; string stateCapital[50]; double lightYears[1,000]; 3. What is wrong with the following array definitions? int readings[-1]; double measurements[4.5]; int size; string name[size]; Negative Decimal String to int 4. What is the difference between an array's size declarator and a subscript? The size declarator is used in a definition of an array to indicate the number of elements the array will have. A subscript is used to access a specific element in an array. 5. Declare and initialize the following arrays in the same line:
Image of page 1
  • Summer '16
  • Array, Subroutine, following array definitions

{[ snackBarMessage ]}

Get FREE access by uploading your study materials

Upload your study materials now and get free access to over 25 million documents.

Upload now for FREE access Or pay now for instant access
Christopher Reinemann
"Before using Course Hero my grade was at 78%. By the end of the semester my grade was at 90%. I could not have done it without all the class material I found."
— Christopher R., University of Rhode Island '15, Course Hero Intern

Ask a question for free

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern