CHALLENGE 5.4.3: Populating a vector with a for loop. ACTIVITY Write a for loop to populate vector userGuesses with NUM

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

CHALLENGE 5.4.3: Populating a vector with a for loop. ACTIVITY Write a for loop to populate vector userGuesses with NUM

Post by answerhappygod »

Challenge 5 4 3 Populating A Vector With A For Loop Activity Write A For Loop To Populate Vector Userguesses With Num 1
Challenge 5 4 3 Populating A Vector With A For Loop Activity Write A For Loop To Populate Vector Userguesses With Num 1 (21.47 KiB) Viewed 18 times
CHALLENGE 5.4.3: Populating a vector with a for loop. ACTIVITY Write a for loop to populate vector userGuesses with NUM GUESSES integers. Read integers using cin. Ex: If NUM GUESSES is 3 and user enters 9 5 2, then userGuesses is (9, 5,2). 4011352641322 xray? 3 using namespace std; 4 5 int main() { 6 7 8 9 10 11 12 13 14 15 16 17 18 const int NUM GUESSES 3; vector<int> userGuesses (NUM GUESSES); unsigned int i; int num; cout<<"Please enter the guesses" << endl; } for (1-0;KNUM GUESSES; i++){ cin>>num; userGuesses.push_back(num); for (i = 0; i < userGuesses.size(); ++i) { cout << userGuesses.at(i) << ""; } Test passed Al teat pa
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply