Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 19 Vector Function CSCI 111 Programming and Algorithms I Due Friday March 8, 11:59PM on turnin 10 Points NEW CONCEPTS: Vector: What is C++

image text in transcribed

image text in transcribed

Lab 19 Vector Function CSCI 111 Programming and Algorithms I Due Friday March 8, 11:59PM on turnin 10 Points NEW CONCEPTS: Vector: What is C++ vector? 1) std::vector is a sequence container that encapsulates dynamic size arrays 2) std::pmr::vector is an alias template that uses a polymorphic allocator. The elements are stored contiguously, which means that elements can be accessed not only through iterators, but also using offsets to regular pointers to elements Task list: 1. Similar to Lab 16, copy the 4-file framework into a new directory named lab19. The 4 files are similar to: Makefile, ParseString.h, lab16.cpp, and ParseString.cpp 2. Your task is to create 2 functions defined in VectorProcess.cpp that are called from the main function. 3. The 2 functions should be defined in VectorProcess.h as: vector PopulateVector(vector int> v); int GetLargest(vector int> v): 4. The function PopulateVector prompts the user for unique integer values between 1-10 and stores them into vector v. The function continues until a value of q is entered. The value of vector v is returned by the function 5. The function GetLargest iterates through the vector v and returns the largest element value found 6. Refer to the expected output listing below. Note that the output shown in RED should be displayed from within the main function. SAMPLE OUTPUT (output shown in RED should be displayed from within the main function) /user/faculty/jraigoza/CSCI111/Labs/lab19 $ ./lab19 Calling function PopulateVector .. . Enter a unique integer value between 1 to 9 (q-quit) . 2 Enter a unique integer value between 1 to 9 (q-quit) 6 Enter a unique integer value between 1 to 9 (q-quit) . 7 Enter a unique integer value between 1 to 9 (g-quit) Enter a unique integer value between 1 to 9 (q-quit) . 1 Enter a unique integer value between 1 to 9 3 Enter a unique integer value between 1 to 9 (q-quit) . (g=quit) Calling function GetLargest The larges t element value in the vector is 9 /user/faculty/jraigoza/CSCI111/Labs/lab19 $ ./lab19 Calling function PopulateVector . . . Enter a unique integer value between 1 to 9 (q-quit) 2 Enter a unique integer value between 1 to 9 (q-quit) . Enter a unique integer value between 1 to 9 (q-quit) 7 Enter a unique integer value between 1 to 9 (q-quit) Enter a unique integer value between 1 to 9 (q-quit) 5 Enter a unique integer value between 1 to 9 (q-quit) Calling function GetLargest.. The largest element value in the vector is 8 /user/faculty/jraigoza/CSCI111/Labs/lab19 $

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions