Write a program that prompts the user to enter phrases (can contain spaces) until they say they’re done, then prints out the phrases in the reverse order they were entered. You must use an array.
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<string> vec;
string str;
getline(cin,str);
while(str.compare("done")!=0) {
vec.push_back(str);
getline(cin,str);
}
for(int i=vec.size()-1; i>=0; i--) {
cout<<vec[i]<<endl;
}
return 0;