Advertisement
Josif_tepe

Untitled

Dec 16th, 2023
570
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void funckija(int * niza, int n, int x) {
  5.     for(int i = 0; i < n; i++) {
  6.         *niza = x;
  7.         niza++;
  8.     }
  9.  
  10. }
  11. int main() {
  12.     int n;
  13.     cin >> n;
  14.     int niza[n];
  15.     for(int i = 0 ; i< n; i++) {
  16.         cin >> niza[i];
  17.     }
  18.    
  19.     int x;
  20.     cin >> x;
  21.     funckija(niza, n, x);
  22.     for(int i = 0; i < n; i++) {
  23.         cout << niza[i] << " ";
  24.     }
  25.     return 0;
  26. }
  27. /*
  28.  5
  29.  1 2 3 4 5
  30.  5
  31.  **/
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement