#include <iostream>
#include <array>
#include <vector>
using namespace std;
const int dSize =10;
int Fill_array(array<double, dSize> *);
void Show_array(array<double, dSize> *,int);
void Reverse_array(array<double, dSize> *,int);
int main() {
array<double, dSize> d;
int count = Fill_array(&d);
cout << "Input " << count << " number to d[dSzie]." << endl;
Show_array(&d, count);
Reverse_array(&d, count);
Show_array(&d, count);
}
int Fill_array(array<double, dSize> * pd) {
int i = 0, count =0;
cout << "Enter a double number: ";
while (i < dSize){
if (cin >> (*pd)[i]) {
count++;
i++;
}
else
break;
}
return count;
}
void Show_array(array<double, dSize> * pd,int count) {
int i = 0;
cout << "all d[" << i << "]" << " ~ d[" << dSize << "]:\n";
while (i < count) {
cout << (*pd)[i++] << " ";
}
cout << "\n";
}
void Reverse_array(array<double, dSize> * pd,int count) {
int end = count - 1, start = 0;
double tmp;
while (start != end) {
tmp = (*pd)[start];
(*pd)[start] = (*pd)[end];
(*pd)[end] = tmp;
start++;
end--;
}
}