The following code defines a vector and an iterator. Rewrite the statement that defines the iterator so it uses the auto key word.
vector<string> strv = {"one", "two", "three"};
vector<string>::iterator it = strv.begin();
Want to see the full answer?
Check out a sample textbook solutionChapter 17 Solutions
Starting Out with C++ from Control Structures to Objects Plus MyLab Programming with Pearson eText -- Access Card Package (9th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Web Development and Design Foundations with HTML5 (8th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Database Concepts (8th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
- matrix = {{1,2},{4,5}} this in c++arrow_forwardWhat header file must you #include in order to define vector objects?arrow_forwardC++ Format Please Write a function (named "Lookup") that takes two const references to vectors. The first vector is a vector of strings. This vector is a list of words. The second parameter is a list of ints. Where each int denotes an index in the first vector. The function should return a string formed by concatenated the words (separated by a space) of the first vector in the order denoted by the second vector. Input of Test Case provided in PDF:arrow_forward
- Create functions using the R language that take five arguments and multiplies them according to the type of object they are: Scalar Vector Matrix Plot each of the functions that you have constructed.arrow_forwardYOU MUST SHOW A LOGICAL VECTOR FOR THIS QUESTION R-PROGRAMMINGarrow_forward4arrow_forward
- #include <iostream>//#include <vector> using namespace std; class Vec {public:Vec() {sz = 0;cap = 1;p_arr = new int[cap];} int size(){return this->sz;}int capacity(){return this->cap;}void reserve( int n ){// TODO:// (0) check the n should be > size, otherwise// ignore this action.if ( n > sz ){// (1) create a new int array which size is n// and get its address//cout << "Adress:"<< &n << endl;int *newarr = new int [n];//cout << "Address: " << newarr << endl; // location // (2) use for loop to copy the old array to the// new arrayfor(int i = 0; i < sz; i++){newarr[i] = p_arr[i];}// (3) update the variable to the new addressthis->cap=n; // (4) delete old arraydelete[] newarr;}}void push_back( int v ){// TODO:if ( sz == cap ){ cap *= 2; reserve(cap);}p_arr[sz++] = v;// complete others}int at(int idx){return this->p_arr[idx];}private://vector<int> arr;int *p_arr;int sz = 0;int cap = 0; }; int main(){Vec v;…arrow_forward#include <iostream> #include <vector> using namespace std; //Function 1 void vectorOutput(vector<double> doubleVector) { cout<<"Current Vector Contents: "; for (inti = 0; i < doubleVector.size(); i++) { cout<<doubleVector.at(i) <<", "; } cout<<endl; } //Function 2 vector<double> reverseVector(vector<double> doubleVector) { intj = 0; for (inti = 0, j = (doubleVector.size() - 1); i < (doubleVector.size() / 2); i++, j--) { doublervector = doubleVector[i]; doubleVector.at(i) = doubleVector.at(j); doubleVector.at(j) = rvector; } returndoubleVector; } //Function 3 vector<double> vectorInput(vector<double> doubleVector) { cout<<"Enter positive double numbers: "<<endl; while (true) { doubleposVector; cin>>posVector; if (posVector < 0) { break; } else { doubleVector.push_back(posVector); } } returndoubleVector; } int main() { vector<double> doubleVector; vector<double> revVector;…arrow_forwardIn C++,define a vector object and initialize it with 3 values and then define an iterator that points to elements of this object, then ask the user to enter 3 more values and then add them to the previous vector and then print all elements in the vector.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education