Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<stdlib.h>
- #include<time.h>
- using namespace std;
- void dellElem(int *&arr,int &size){
- for(int i=1; i<size;i++)
- {
- for(int j=i;j<size-1;j++){
- arr[j]=arr[j+1];
- }
- size--;
- }
- }
- void showMas(int *arr,int a){
- for(int i=0;i<a;i++)
- {
- cout<<arr[i]<<" ";
- }
- }
- int main()
- {
- setlocale(LC_ALL,"rus");
- int *arr;
- int size;
- srand(time(NULL));
- cout<<"Ââåäèòå ðàçìåð ìàññèâà: ";
- cin>>size;
- arr = new int[size];
- cout<<"Ñãåíåðèðîâàííûé ìàññèâ: ";
- for(int i=0; i<size; i++){
- arr[i]=rand() % 10;
- cout<<arr[i]<<" ";
- }
- cout<<"\n";
- dellElem(arr, size);
- showMas(arr,size);
- system("pause");
- delete [] arr;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement