write a c++ programme to print any 10 no given in array in reverse order
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int st(int s) //function that raises 10 to a power
{ //of s which is an argument
int val=1;
for (int i=0; i<s; i++)val*=10;
return val;
}
int main(int argc, char *argv[])
{
int array[10]; //array to input
string s; //string for reading one integer form the line
int i,j,length; //counters and a variable for string length
for (i=0; i<10; i++)array[i]=0; & //fill the array with nulls
cout<<"Enter 10 integers separated by spaces"<<endl;
for (i=0; i<=9; i++) //cycle for filling the array with 10 integers
{
& cin>>s; //read one integer
& length=s.length(); & //count its length
& for (j=0; j<length; j++) & //take one digit from integer
& {
array[i]+=int(s[j]-'0')*st(length-1-j); //convert it from char to int,
& } //multiple it to the proper power of 10 and save in array
}
for (i=9; i>=0; i--)cout<<array[i]<<' '; //output the array in reverse order
system("PAUSE");
return EXIT_SUCCESS;
}