Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

WRITE A C++ PROGRAM ---- Exercise 1: Squared and cubed random numbers Write a C++ program that generates 10 random numbers each falling in the

WRITE A C++ PROGRAM

image text in transcribed

----

image text in transcribed

Exercise 1: Squared and cubed random numbers Write a C++ program that generates 10 random numbers each falling in the range of 0 and 10. These random numbers should be printed in the first column, the square and cube of these numbers should be printed in the second and third columns, respectively, as shown in the sample input/output given. Hint: you can use setw() for formatting. Sample input/output: Random_num Squared 7 49 64 8 64 6 36 4 16 3 9 1 1 81 16 00 00 moto Cubed 343 512 512 216 64 27 1 729 64 0 Exercise 2: Three random arrays Write a C++ program that creates three integer arrays, i.e. A1, A2, and A3, each of size 10. A1 should be filled with random numbers each number in the range of [1, 5); whereas, A2 should also be filled with random numbers but in the range of [5, 10). You should then add the contents of A1 and A2 and store in A3. Finally, you should print the arrays in the format shown in the sample input/output given below. Hint: you can use setw() for formatting. Sample input/output: A1: 3 1 3 7 10 A2: A3: 1 7 8 3 9 1 3 6 8 7 11 1 5 6 6 9 293 9 13 8 9 12

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_2

Step: 3

blur-text-image_3

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

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago