What I want to do is to enter a number of loops , then all the entered words will be displayed on reverse . I tried numbers to display on reverse , and it works . But , I don't know what to change in the codes . I'm not good in c++ , so I'm practicing . Thanks for helping me =)
#include <iostream>
#include <string>
using namespace std;
int main()
{
int x, y;
string a[y];
cout << "Enter number: ";
cin >> x;
x=x-1;
for (y=0; y<=x; y++)
{
cout << y+1 << ". ";
cin >> a[y];
}
for (y=x; y>=0; y--)
{
cout << a[y] << endl;
}
return 0;
}
string a[y];you'll need to put this line at least aftercin >> x; x=x-1;