4.2.3 Printing vector elements with a for loop.

docx

School

Southern New Hampshire University *

*We aren’t endorsed by this school

Course

210

Subject

English

Date

Nov 24, 2024

Type

docx

Pages

1

Uploaded by DrRoseLoris32

Report
emary | 423 ing vector elements with a for loop. rte afor oopto print al NUM_VALS elements of vector courseGrades,following each with a space (inciuding the last). Print forwards, then back jth newine. Ex. If courseGrades = 7, 9, 11, 10}, print. 79110 L1197 Hint:Use two for loops. Second loop starts with | = courseGrades size() - 1 Note: Tnese activitiss may test coge with different test values This (vectoreint> courseGrades(4)). See ity will perform two tests, both with a 4-¢lement v Also rote: If the submitted code has errors, the test may generate strange results. O the test ma, never reached, in Wnich case the system dossn print the test case sh and report Program end t caused the reported message. 7 Vet wrseuraves um_vacs 5 R 8 ot 5 1o for (i=9; 1< coursesrades.size(); ++1) { n cin >> courseGrades. 3t(1); 1y B 1 for (1= 9; 1< coursesrades.size(); ++1) { 15 cout < coursetrades.at() < ° 16 17 cout < endl; B 15 for (i = coursesrades.size() -1; 1 » cout << coursetrades. at() << 2 2 cout << endl; 2 retum o > n [ e R
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