For questions 1 and 2 declare the array size as name constant first then use it to declare the array
1. Declare an array named scores of type double and size 30.
2. Declare an array named names of string objects and size 15
3. Given the following array definition:
int values[] = {2, 5, 8, 11};
What does each of the following
display?
B) cout <<
value[3]+values[0];
1.
const int size = 30;
double scores[size];
2.
const int size = 15;
string names[size];
3.
The given array is:
int values[] = {2, 5, 8, 11};
A.
The statement as given below:
cout << values[1];
OUTPUT:
5
B.
The statement as given below:
cout << value[3]+values[0];
OUTPUT:
13
The three element array declaration is given below:
//character array declaration and initialization
char letters[3] = {'E', 'G', 'P'};
//display the third element
cout<<letters[2];
Get Answers For Free
Most questions answered within 1 hours.