Hello

I'm a beginner at c++ I got these questions for homework. Would appreciate answers to these questions.

Consider the following code for these questions

                  const int NUMBER_OF_ITEMS = 5;
                  double nums [NUMBER_OF_ITEMS];

Question 1
What is the index of the first and last element in the array?

Question 2
Write a statement to store the value 5.6 in the 3rd location of the array, and another statement to output the 3rd location of the array to the console.

Question 3
Write a loop that will fill up the array by asking the user for input.

Question 4
Write down some code to output all the elements of the array that are greater than 22.

Question 5
What is the meaning of the word 'const', and give one good reason why it is good to declare a const variable for the size of an array?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.