Advertisement
JewishCat

vlad.11

Jun 28th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. void mas(double* a, int n) {
  4.     double buf = 0;
  5.     for (int i = 0, j = n - 1; i<j; i++, j--)
  6.     {
  7.         buf = a[i];
  8.         a[i] = a[j];
  9.         a[j] = buf;
  10.     }
  11. }
  12. int main()
  13. {
  14.     int n = 10;
  15.     double* i = new double[n];
  16.     for (int a = 0; a < n; a++) {
  17.         i[a] = a + 0.5;
  18.     }
  19.     mas(i,n);
  20.     for (int a = 0; a < n; a++) {
  21.         cout << i[a] << " ";
  22.     }
  23.     system("pause");
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement