chillurbrain

Task6_7_2

Dec 21st, 2015
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <conio.h>
  4.  
  5. using namespace std;
  6.  
  7. void change(int *arr, int n, int val)
  8. {
  9.     int* pointer = &arr[n-1];
  10.     *pointer = val;
  11. }
  12.  
  13. int main()
  14. {
  15.     const int SIZE = 5;
  16.     int array[SIZE];
  17.     int n;
  18.     int val;
  19.     for(int i = 0; i < 5; i++)
  20.         cin >> array[i];
  21.     cin >> n;
  22.     cin >> val;
  23.     change(array, n, val);
  24.     for(int i = 0; i < 5; i++)
  25.         cout << array[i];
  26.     _getch();
  27.     return 0;
  28. }
Add Comment
Please, Sign In to add comment