Răspuns :
Răspuns:
1)
{
int n,i,x=0,y=0;
cout<<"n=";
cin>>n;
int v[n];
for(i=1;i<=n;i++)
{
cout<<"v["<<i<<"]=";
cin>>v[i];
}
int a[x],b[y];
for(i=1;i<=n;i++)
{
if(v[i]>0)
{
x++;
a[x]=v[i];
}
if(v[i]<0)
{
y++;
b[y]=v[i];
}
}
for(i=1;i<=x;i++)
cout<<a[i]<<" ";
cout<<endl;
for(i=1;i<=y;i++)
cout<<b[i]<<" ";
return 0;
}
2)
{
int n,i;
cout<<"n=";
cin>>n;
int a[n];
for(i=1;i<=n;i++)
{
cout<<"a["<<i<<"]=";
cin>>a[i];
}
int sortat,aux;
do
{
sortat=0;
for(i=1;i<n;i++)
if(a[i]>a[i+1])
{
aux=a[i];
a[i]=a[i+1];
a[i+1]=aux;
sortat=1;
i=0;
}
}while(!sortat);
cout<<n<<" ";
for(i=1;i<=n;i++)
cout<<a[i]<<" ";
return 0;
}
Explicație:
Multumesc+5*+cel mai inteligent raspuns?
Scuze ca nu este in fisier, eu nu am ajuns inca acolo