Write one or more statements that perform the following tasks for an array called fractions:

) Define a constant variable arraySize to represent the size of an array and initialize it to 10
b) Declare an array with arraySize elements of type double, and initialize the elements
to 0.
c) Name the fourth element of the array.
d) Refer to array element 4.
e) Assign the value 1.667 to array element 9.
f) Assign the value 3.333 to the seventh element of the array.
g) Display array elements 6 and 9 with two digits of precision to the right of the decimal
point, and show the output that’s actually displayed on the screen.
h) Display all the array elements using a counter-controlled for statement. Define the integer variable i as a control variable for the loop. Show the output.
i) Display all the array elements separated by spaces using a range-based for statement.


```
a) const size_t arraySize{10};
b) array fractions{0.0};
c) fractions[3]
d) fractions[4]
e) fractions[9] = 1.667;
f) fractions[6] = 3.333;
g) cout << fixed << setprecision(2);
cout << fractions[6] << ' ' << fractions[9] << endl;
Output: 3.33 1.67
h) for (size_t i{0}; i < fractions.size(); ++i) {
cout << "fractions[" << i << "] = " << fractions[i] << endl;
} Output: fractions[0] = 0.0
fractions[1] = 0.0
fractions[2] = 0.0
fractions[3] = 0.0
fractions[4] = 0.0
fractions[5] = 0.0
fractions[6] = 3.333
fractions[7] = 0.0
fractions[8] = 0.0
fractions[9] = 1.667
i) for (double element : fractions)
cout << element << ' ';
```

Computer Science & Information Technology

You might also like to view...

Which of the following statements is false?

a. A lambda that receives two ints, x and y, and returns their sum is ``` (int x, int y) -> {return x + y;} ``` b. A lambda’s parameter types may be omitted, as in: ``` (x, y) -> {return x + y;} ``` c. A lambda with a one-expression body can be written as: ``` (x, y) -> x + y ``` In this case, the expression’s value is implicitly returned. d. When a lambda's parameter list contains only one parameter, the parentheses may be omitted, as in: ``` value -> System.out.printf("%d ", value) ```

Computer Science & Information Technology

Discuss how the proposed SQL:2011 standard will handle object identity and give an example of its intended use.

What will be an ideal response?

Computer Science & Information Technology

Which of the following is true about the SQL language?

A. it is case sensitive B. keywords must be written in uppercase C. the semicolon is a statement terminator D. statement terminators are required at the end of a statement

Computer Science & Information Technology

The ______ provides a benchmark by which businesses can measure how well they are protecting the privacy of individuals.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology