Write C++ statement(s) to do the following: Declare an array alpha of 50 components of type int. Initialize each component of alpha to -1. Output the value of the first component of the array alpha. Set the value of the twenty-fifth component of the array alpha to 62. Set the value of the tenth component of alpha to three times the value of the fiftieth component of alpha plus 10. Use a for loop to output the value of a component of alpha if its index is a multiple of 2 or 3. Output the value of the last component of alpha. Output the value of the alpha so that 15 components per line are printed. Use a for loop to increment every other element (the even indexed elements). Use a for loop to create a new array, diffAlpha, whose elements are the differences between consecutive elements in alpha.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.1: One-dimensional Arrays
Problem 4E: (Practice) a. Write output statements using cout that can be used to display values from the first,...
icon
Related questions
Question

Write C++ statement(s) to do the following:

  1. Declare an array alpha of 50 components of type int.
  2. Initialize each component of alpha to -1.
  3. Output the value of the first component of the array alpha.
  4. Set the value of the twenty-fifth component of the array alpha to 62.
  5. Set the value of the tenth component of alpha to three times the value of the fiftieth component of alpha plus 10.
  6. Use a for loop to output the value of a component of alpha if its index is a multiple of 2 or 3.
  7. Output the value of the last component of alpha.
  8. Output the value of the alpha so that 15 components per line are printed.
  9. Use a for loop to increment every other element (the even indexed elements).
  10. Use a for loop to create a new array, diffAlpha, whose elements are the differences between consecutive elements in alpha.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr