You are working on problem set: Lab 1 copy (Pause) problem ID #6049 ? addStars Language/Type: C++vector collections STL Related Links: vector Write a function named addStars that accepts as a parameter a reference to a vector of strings, and modifies the vector by placing a "." element between elements, as well as at the start and end of the vector. For example, if the vector v contains ("the", "quick", "brown", "fox"), the call of addStars (v); should modify it to store ("", "the", "", "quick", "", "brown", "", "fox", ""). O You passed 3 of 4 tests. Try again. test #1: addStars (("the", "quick", "brown", "fox")); parameters: ("", "the", "", "quick", "", "brown", "", "fox", "") result: pass test #2: addStars(("a", "a", "a")); parameters: ("", "a", "", "a", "", "a", "") result: pass test #3: addStars(("xyz")); parameters: ("*", "xyz", "") result: pass test #4: exp. params: your parameters: addStars (()); ("") ("","") result: fail details: incorrect parameter value(s) after call 2 #include 3 #include 4 void addStars (std::vector &v) ( int size v.size(); 6 7 8 9 18 11) 12 int main() ( 13 15 16 17 18 19 28) 21 22 ង ឆ ដ ឌ ដ ឆ ន 2. 23 24 25 27 28 v.insert(v.begin(), ""); v.insert(v.end(), ""); for (int i= size; i > 1; i--) { v.insert(v.begin() 1, ""); } 29 std::vector v ("the", "quick", "brown", "fox"); addStars(v); for (const auto &s: v) ( std::cout << s << " "; } std::cout << std::endl; return 8: Function: Write a C++ function as described, not a complete program. ✔ Submit
You are working on problem set: Lab 1 copy (Pause) problem ID #6049 ? addStars Language/Type: C++vector collections STL Related Links: vector Write a function named addStars that accepts as a parameter a reference to a vector of strings, and modifies the vector by placing a "." element between elements, as well as at the start and end of the vector. For example, if the vector v contains ("the", "quick", "brown", "fox"), the call of addStars (v); should modify it to store ("", "the", "", "quick", "", "brown", "", "fox", ""). O You passed 3 of 4 tests. Try again. test #1: addStars (("the", "quick", "brown", "fox")); parameters: ("", "the", "", "quick", "", "brown", "", "fox", "") result: pass test #2: addStars(("a", "a", "a")); parameters: ("", "a", "", "a", "", "a", "") result: pass test #3: addStars(("xyz")); parameters: ("*", "xyz", "") result: pass test #4: exp. params: your parameters: addStars (()); ("") ("","") result: fail details: incorrect parameter value(s) after call 2 #include 3 #include 4 void addStars (std::vector &v) ( int size v.size(); 6 7 8 9 18 11) 12 int main() ( 13 15 16 17 18 19 28) 21 22 ង ឆ ដ ឌ ដ ឆ ន 2. 23 24 25 27 28 v.insert(v.begin(), ""); v.insert(v.end(), ""); for (int i= size; i > 1; i--) { v.insert(v.begin() 1, ""); } 29 std::vector v ("the", "quick", "brown", "fox"); addStars(v); for (const auto &s: v) ( std::cout << s << " "; } std::cout << std::endl; return 8: Function: Write a C++ function as described, not a complete program. ✔ Submit
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
getting error please help

Transcribed Image Text:You are working on problem set: Lab 1 copy Pause)
problem ID #6049
? addStars
Language/Type: C++ vector collections STL
Related Links: vector
Write a function named addStars that accepts as a parameter a reference to a vector of strings, and modifies the vector by placing a "*" element between elements,
as well as at the start and end of the vector. For example, if the vector v contains {"the", "quick", "brown", "fox"), the call of addStars (v); should modify it to
store {"*", "the", "*", "quick", "*", "brown", "*", "fox", "*"}.
You passed 3 of 4 tests. Try again.
test #1: addStars({"the", "quick", "brown", "fox"});
parameters: {"*", "the", "*", "quick", "*", "brown", "*", "fox", "*"}
✔ pass
result:
test #2: addStars({"a", "a", "a"});
parameters: {"*", "a", "*", "a", "*", "a", "*"}
result:
✔ pass
test #3: addStars({"xyz"});
parameters: {"*", "xyz", "*"}
result:
pass
test #4:
exp. params:
your parameters:
addStars({});
{"*"}
{"*", "*"}
result: ✪ fail
details: incorrect parameter value(s) after call
1 #include <iostream>
2 #include <vector>
3 #include <string>
4 void addStars (std::vector<std::string> &v) {
5
int size= v.size();
6
7
8
9
19
20}
v.insert(v.begin(), "*");
v.insert(v.end(), "*");
for (int i = size; i > 1; i--) {
v.insert(v.begin() + i, "*");
10
11 }
12 int main() {
13
14
15
16
17
18
21
22
23
24
25
26
27
28
29
}
std::vector<std::string> v = {"the", "quick", "brown", "fox"};
addStars (v);
for (const auto &s: v) {
std::cout << s << " ";
}
std::cout << std::endl;
return 0;
Function: Write a C++ function as described, not a complete program.
Submit
X
Expert Solution

Overview
In this question we have to write a function named addStars with the following given problem statement in C++ programming language
Let's code
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education