Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <fstream>
- using namespace std;
- void sterge(int v[],int &n,int i,int j)
- {
- int oldn=n,st,dr;
- st=i;
- dr=j;
- n=n-(dr-st+1); ///modific nr de elem
- for(int poz = st ; poz<=oldn ;poz++){
- if(poz+(dr-st+1)<=oldn){
- v[poz] = v[poz+(dr-st+1)]; ///mut toate elem cu dr-poz+1 pozitii spre stanga
- }
- }
- }
- int main()
- {
- int n,a[1001],k=0;
- cin>>n;
- for(int i=1;i<=n;i++){
- cin>>a[i];
- }
- sterge(a,n,2,4); ///apelul
- for(int i=1;i<=n;i++){
- cout<<a[i]<<" ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement