Hello, dear all, here is my algorithm. i'm trying to reverse the array but its not function and not loop.
#include <iostream>
using namespace std;
void initial(int *v, int N)
{ int i;
for(i=1; i<=N; i++)
v[i] = i;
}
void write (int *v, int N)
{
for (int i = 1 ; i <= N; i++)
cout << v[i] << "";
cout <<"\n";
}
void reverse (int *v, int N)
{
int tmp = v[1];
for (int i = 1; i<N-2; ++i)
{
v[i] = v[N-i-1];
v[N-i-1] = tmp;
}
}
int main(int *v)
{ int N;
cout << "enter size of element:";
cin >> N;
if (N >0 && N<=100){
int *v = new int [N];
initial (v,N);
write (v,N);
reverse (v,N);
delete v;
}