Your array must contain 10 elements. Collect these from the user. Print the original array to the console. Create a function and pass the original array to it as a parameter. Multiple the values of the original array by their index and store the product in an array local to your function. Print the second array (with the multiplied values) to the console.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 17RQ
icon
Related questions
Question
100%

Hello, could you help with this c++ programming question? Thanks!

Description: For this assignment, you will write a program with an array of 10 values collected from the
user. Pass the array to a function and multiple the values by their index. Store the product in a new array
and display the value. See the sample test data for examples.
Transcribed Image Text:Description: For this assignment, you will write a program with an array of 10 values collected from the user. Pass the array to a function and multiple the values by their index. Store the product in a new array and display the value. See the sample test data for examples.
Your array must contain 10 elements. Collect these from the user.
Print the original array to the console.
Create a function and pass the original array to it as a parameter.
Multiple the values of the original array by their index and store the product in an array local to
your function.
Print the second array (with the multiplied values) to the console.
Transcribed Image Text:Your array must contain 10 elements. Collect these from the user. Print the original array to the console. Create a function and pass the original array to it as a parameter. Multiple the values of the original array by their index and store the product in an array local to your function. Print the second array (with the multiplied values) to the console.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

I tried to run this program and it came up with this error do you know why?

Source.cpp X
+1d Arrays exercise 1
1
2
3
4
90 %
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
211
Evoid func(int a[], int len) {
int b[len];
for (int
b[k]
A
#include <iostream>
using namespace std;
B
Bint main() {
8
Error List
Entire Solution
Code
▷ abc E0028
> C2131
X C3863
A C4552
(parameter) int len
Search Online
expression must have a constant value
cout <<
for (int the value of parameter "len" (declared at line 4) cannot be used as a constant
cout
Search Online
int arr[10];
X 1
cout << "Enter the 10 elemnents of array:" << endl;
for (int i = 0; i < 10; i++) {
cin >> arr[i];
}
cout << "The original array is:" << endl;
for (int j = 0; j < 10; j++) {
cout <<< arr[j] << " ";
A 0
个
↓
◄
(Global Scope)
3 Errors A 1 Warning
Description
expression must have a constant value
expression did not evaluate to a constant
array type 'int [len]' is not assignable
'<<': result of expression not used
✪ 0 of 3 Messages
197 Build + IntelliSense
func(int a[], int len)
▶
Project
1d Arrays exercise 1
1d Arrays exercise 1
1d Arrays exercise 1
1d Arrays exercise 1
Ln: 5
Ch: 9
File
Search Error List
Col: 12
Source.cpp
Source.cpp
Source.cpp
Source.cpp
TABS
+
CRLF
▼ д х
Line
5
5
7
12
8.
Toolbox Notifications Properties.
Transcribed Image Text:Source.cpp X +1d Arrays exercise 1 1 2 3 4 90 % 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 211 Evoid func(int a[], int len) { int b[len]; for (int b[k] A #include <iostream> using namespace std; B Bint main() { 8 Error List Entire Solution Code ▷ abc E0028 > C2131 X C3863 A C4552 (parameter) int len Search Online expression must have a constant value cout << for (int the value of parameter "len" (declared at line 4) cannot be used as a constant cout Search Online int arr[10]; X 1 cout << "Enter the 10 elemnents of array:" << endl; for (int i = 0; i < 10; i++) { cin >> arr[i]; } cout << "The original array is:" << endl; for (int j = 0; j < 10; j++) { cout <<< arr[j] << " "; A 0 个 ↓ ◄ (Global Scope) 3 Errors A 1 Warning Description expression must have a constant value expression did not evaluate to a constant array type 'int [len]' is not assignable '<<': result of expression not used ✪ 0 of 3 Messages 197 Build + IntelliSense func(int a[], int len) ▶ Project 1d Arrays exercise 1 1d Arrays exercise 1 1d Arrays exercise 1 1d Arrays exercise 1 Ln: 5 Ch: 9 File Search Error List Col: 12 Source.cpp Source.cpp Source.cpp Source.cpp TABS + CRLF ▼ д х Line 5 5 7 12 8. Toolbox Notifications Properties.
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Arrays
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage