Question: 1. Write C++ statements which declare the parkingSpots as a of type two-dimensional int array, sized NUM_OF_ROWS by NUM_OF_COLS, then write another statement which calls

1. Write C++ statements which declare the parkingSpots as a of type two-dimensional int array, sized NUM_OF_ROWS by NUM_OF_COLS, then write another statement which calls the function from the previous problem with this new array.

2. Write the C++ definition of a void function with a single formal parameter of type two-dimensional int array, sized NUM_OF_ROWS by NUM_OF_COLS. Assume NUM_OF_ROWS and NUM_OF_COLS are defined integer constants. Have the function read from common input in order to fill the contents of the array which is passed in.

3.

3. Given the following C++ code

char name[8];

strcpy(name, " Robert");

mark the following statements as Yes if they precisely output Robert. Otherwise, mark the statement as No and explain the reason why.

a. cout << name;

Answer:

b. for(int j = 0; j < 5; j++)

cout << name[j];

Answer:

c. int j = 0;

while(name[j] != '\0')

cout << name[j++];

Answer:

d. for(int j = 0; j < 8; j++)

cout << name[j];

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!