Answer:
Following are the error in the given program are explain in the explanation part .
Explanation:
The main() function call the function getMileage() function after that the control moves to the getMileage() definition of function. In this firstly declared the "mileage" variable after that it taking the input and module is finished we see that the "mileage" variable is local variable i,e it is declared inside the " Module getMileage() " and we prints in the main module that are not possible to correct these we used two technique.
Technique 1: Declared the mileage variable as the global variable that is accessible anywhere in the program.
Technique 2: We print the value of "mileage" inside the Module getMileage() in the program .
Answer:
B) navigate to the Custom table of Contents dialogue box
Explanation:
Answer:
#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
int[] array = new int[10];
int index = 0;
while(index < array.size()){
int number = (rand() % 100) + 1;
for (int i = 0; i < 1; i++) {
array[index] = number;
cout<< "Position "<< index << "of the array = "<< number << endl;
++index;
}
}
}
Explanation:
The while loop in the source code loops over a set of code ten times, The for loop only loops once to add the generated random number between 1 and 100 to the array of size 10. At the end of the for loop, the index location and the item of the array is printed out on the screen. The random number is generated from the 'rand()' function of the C++ standard library.