Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Ask the user how many numbers to enter. This is the code I have is there another way to write it using arrays as well:

Ask the user how many numbers to enter.

This is the code I have is there another way to write it using arrays as well:

#include

using namespace std;

int main()

{

int y,i;

cout<<"How many number would you like to enter?";

cin>>y;

int a[y];

for (i=0;i

{

cout<<"Enter number"<

cin>>a[i];

}

cout<<"The numbers you entered are: ";

for (i=0;i

{

if (i!=y-1)

cout<

else

cout<

}

return 0;

}

Enter those numbers into an Array, and then Show them.

Sample Run:

How many numbers would you like to enter? 8

Enter number 1: 5

Enter number 2: 3

Enter number 3: 10

Enter number 4: 15

Enter number 5: 25

Enter number 6: 21

Enter number 7: 99

Enter number 8: 16

The numbers you entered are: 5, 3, 10, 15, 25, 21, 99, 16

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions