4.4.3 Populating a vector with a for loop.

docx

School

Southern New Hampshire University *

*We aren’t endorsed by this school

Course

210

Subject

Computer Science

Date

Nov 24, 2024

Type

docx

Pages

1

Uploaded by DrRoseLoris32

Report
oy | 443 Pulating a vector with a for ioop. Wiite a for loop to populate vector userGuesses with NUM_GUESSES integers. Read integers using cin. Ex. If NUM_GUESSES is 3 d user enters 9 5.2, then userGuesses is 9, 5, 2. 1 #include <iostream 2 #include cvectors 3 using nanespace std; H 5 int main() { & const int MmGuEssEs = 3; 7 vectorcint> userGuesses (MM GUESSES); 5 unsigned int 1 10 for (1- ;1< usersiesses.size(); ) [{ n cin > usercuesses.at(D)} uof 2 for (1= 0; 1< usersuesses.size(); ++i) { 15 cout < userGuesses. at(i) < * % Testing withinputs: 246 Your output + Testing with inputs: 8 Youroutput | & 12 1
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help