Question: What does the following fragment print: #include #include #include using namespace std; int main ( ) { vector a = { a ,

What does the following fragment print:
#include
#include
#include
using namespace std;
int main(){
vector a ={"a","b","c"};
int n = a.size();
stack s;
for (int i =0; i < n; i++){
s.push(a[i]);
for (int j =0; j < i; j++)
s.push(a[j]);
}
while (!s.empty()){
cout << s.top()<< endl;
s.pop();
}
return 0;
}
Group of answer choices
b a c a b a
c a c a b a
b c c a a a
b b c c a a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!