Create a vector of strings called words that contains "Oregon" and "Washington". Then read in three more words (using cin >> into a string variable you create) and add them to the end of the vector.
Write the function void removeLastHalf(vector<int>& vec); that removes the last half of the vector. If the size is odd, round up the number of items to keep (so for a 5 item list you should keep the first 3 items and remove the last two).
Write the function vector<int> swapEnds(const vector<int>& original); that copies the given vector and then swaps the first and last items of the copy before returning the copy.
This is not really a traversal problem. Yes, you will need a loop, but you do not need to visit every element. Start by just checking the last element and calling .pop_back() to remove it if it is 0. Then you can repeat that process until the last element is not 0.
You will need a loop based on βwhat is the value of the last elementβ. Remember that the last element is at index .size() - 1 and changes each time you remove something from the back.
Write a function isBlankFree that takes a vector of strings and returns true if there are no empty strings ("") in it. Return false if there is at least one empty string.
Tip: start by making a function that returns true to make sure you have the function prototype correct. Once the function compiles, you can worry about passing the tests.
Write a function limit that takes a vector of integers and returns a new vector that is a copy of the original where every value less than 0 is set to 0 and every value greater than 100 is set to 100.
Tip: start by making a function that makes an empty vector of integers and returns it to make sure you have the function prototype correct. Once the function compiles, you can worry about passing the tests.