SHARE
TWEET

ЯЛЮБЛЮЧОЫ

a guest May 19th, 2017 40 in 3 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void input(int *arr, int size){
  5.     for (int i=0;i<size;i++)
  6.         cin>>arr[i];
  7. }
  8. void show(int *arr, int size){
  9.     for(int *p = arr; p < arr + size; p++)
  10.         cout << *p << " ";
  11.     cout << endl;
  12. }
  13. int *resize(int *arr, int *old_size){
  14.     int *new_arr = new int[*old_size+1], i;
  15.     for (i = 0; i < *old_size; i++)
  16.         new_arr[i] = arr[i];
  17.     delete [] arr;
  18.     *old_size =*old_size+1;
  19.     return new_arr;
  20. }
  21. void net(int *lol1,int *lol2,int n,int *f){
  22.     int g=-320000000;
  23.     for (int i=0;i<n;i++){
  24.         if (lol1[i]>f){
  25.             lol2[*f]=lol1[i];
  26.             f=lol1[i];
  27.             lol2=resize(lol2,f);
  28.         }
  29.     }
  30. }
  31.  
  32. int main(){
  33.     int size;
  34.     cin >> size;
  35.     int *arr = new int[size];
  36.     int *arr1 = new int [1];
  37.     int g=0;
  38.     input(arr, size);
  39.     net(arr,arr1,size,&g);
  40.     sho2(arr1,g);
  41.     delete [] arr;
  42.     delete [] arr1;
  43. }
RAW Paste Data
Want to get better at C++?
Learn to code C++ in 2017
Top