Answer:
The program written in C++ is as follows'
#include<iostream>
using namespace std;
int main()
{
string names[3];
cout<<"Please enter three names: "<<endl;
for (int i = 0; i< 3;i++)
{
cin>>names[i];
}
for (int i = 2; i>= 0;i--)
{
cout<<names[i]<<endl;
}
return 0;
}
Explanation:
This line declares an array for 3 elements
string names[3];
This line prompts user for three names
cout<<"Please enter three names: "<<endl;
This following iteration lets user input the three names
for (int i = 0; i< 3;i++) { cin>>names[i]; }
The following iteration prints the three names in reverse order
for (int i = 2; i>= 0;i--) { cout<<names[i]<<endl; }