Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 10 pts (10 pts)Select the best answer for the following task (Efficiency counts): Write code to declare a vector of type int, fill

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Question 1 10 pts (10 pts)Select the best answer for the following task (Efficiency counts): Write code to declare a vector of type int, fill it with 360 random values in the range 1 to 250 inclusive, and then display the sum of the values in the vector. (Efficiency counts vector cint> V int size360, sum-0: forlint i-0:iksize:it+) V.push, backrand()%250+1); sum+= Vlil: MNo need for two loops! cout V int size 360, sum-0; forfint i-0:issizeit+) Vli]=(rand()%250+1); for(int i-0issizeit+) sum+= Vil: cout VI360); int size360, sum-0: forlint i-0:iksize:i++) V.push-back(rand()%250+1): for(int i-0i V int size360, sum-0: forint 1-0size:i++) V.push, back(rand()%2 50+1): NFill the vector forint 1-0:iVsize();i++) sum+= Vli]: 'sum the values! cout

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

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions

Question

What are the three formal responsibilities of a board of directors?

Answered: 1 week ago