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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started