Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
15 views3 pages

PB Vectori

The document contains several C++ functions for array manipulation, including finding the minimum, maximum, and sum of elements, counting zeros in an array, and extracting even numbers. It also includes a function to delete elements from an array within a specified range. The main function demonstrates the use of these operations based on user input.

Uploaded by

teodora.morodan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

PB Vectori

The document contains several C++ functions for array manipulation, including finding the minimum, maximum, and sum of elements, counting zeros in an array, and extracting even numbers. It also includes a function to delete elements from an array within a specified range. The main function demonstrates the use of these operations based on user input.

Uploaded by

teodora.morodan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

40

void P(int n, int x[],int &mini, int &maxi, int &sum)


{
mini=x[0],maxi=x[0],sum=0;
for(int i=0; i<n; i++)
{
if(x[i]<mini)
mini=x[i];
if(x[i]>maxi)
maxi=x[i];
sum=sum+x[i];
}
}

4238

#include <iostream>

using namespace std;


int NrZero(int a[],int n)
{
int i=1,cont=0;
while(i<=n && a[i]%2!=0)
{
i++;
}
if(i>n)
return 0;
while(i<=n && a[i]==0)
{
cont++;
i++;
}
return cont;
}
int main()
{
int n,a[10000];
cin>>n;
for(int i=1; i<=n; i++)
{
cin>>a[i];
}
cout<<NrZero(a,n);

}
41

#include <iostream>

using namespace std;


void F(int n, int a[],int &k)
{
k=0;
int cont=0;
for(int i=0;i<n;i++)
{
if(a[i]%2==0)
{
cont++;
k=k*10+a[i];
}
}
if(cont==0)
{
k=-1;
}
}

42

void sterge(int v[], int &n, int i, int j)


{
int k=j-i+1;
for (int p=j+1; p<=n; p++)
{
v[p-k]=v[p];
}
n=n-k;
}

sau

void sterge(int v[], int &n, int i, int j)


{
int k=i;
while(k<=j)
{
///stergem elementul de pe poz k
for(int p=k+1;p<=n;p++)
{
v[p-1]=v[p];
}
n--;
j--;
}
}

You might also like