Write a program that: 1. Prompts the user to enter an integer representing the size of an array of integers 2. Fills the array with integers from the user input 3. Creates an array of integers to hold the differences between two consecutive elements, fills it accordingly and displays it Example: In the below sample run, the aray is of size 7 and is filled using values entered by the user with the below integers. The array of differences contains -10 which is (22 – 32), 2 which is (32 – 30), -18 which is (30 – 48) and so forth.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter16: Searching, Sorting And Vector Type
Section: Chapter Questions
Problem 21PE
icon
Related questions
Question
Write a program that:
1. Prompts the user to enter an integer representing the size of an array of integers
2. Fills the array with integers from the user input
3. Creates an array of integers to hold the differences between two consecutive elements, fills it
accordingly and displays it
Example: In the below sample run, the array is of size 7 and is filled using values entered by the user with
the below integers.
The array of differences contains -10 which is (22 – 32), 2 which is (32 – 30), -18 which is (30 – 48) and so
forth.
Sample run:
Enter the size of the array: 7
Enter 7 integers: 22
32
30
48
54
26 21
Differences: -10
-18
-6
28
2.
Transcribed Image Text:Write a program that: 1. Prompts the user to enter an integer representing the size of an array of integers 2. Fills the array with integers from the user input 3. Creates an array of integers to hold the differences between two consecutive elements, fills it accordingly and displays it Example: In the below sample run, the array is of size 7 and is filled using values entered by the user with the below integers. The array of differences contains -10 which is (22 – 32), 2 which is (32 – 30), -18 which is (30 – 48) and so forth. Sample run: Enter the size of the array: 7 Enter 7 integers: 22 32 30 48 54 26 21 Differences: -10 -18 -6 28 2.
Expert Solution
steps

Step by step

Solved in 2 steps

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++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning