I dont know if it is corect cuz is givin me error
#include <iostream>
using namespace std;
int main()
{
int i,j,m,l,n,x,plus[100],minus[100];
cout<<"How many numbers? ";
cin>>n;
m=0;
l=0;
do
{
cout<<"Enter a number. ";
cin>>x;
if(x>=0) { plus[m]=x; m++; }
else { minus[l]=x; l++; }
j=m+l;
}
while(j<n);
cout<<endl;
for(i=0;i<m;i++)
for(int k=1;k<m-i;k++)
if(plus[k]<plus[k-1]) swap(plus[k],plus[k-1]);
for(i=0;i<l;i++)
for(int k=1;k<l-i;k++)
if(minus[k]<minus[k-1]) swap(minus[k],minus[k-1]);
cout<<"Positive numbers: "<<endl;
for(i=0;i<m;i++)
cout<<plus[i]<<" ";
cout<<"Negative numbers: "<<endl;
for(i=0;i<l;i++)
cout<<minus[i]<<" ";
system("pause");
return 0;
}
Looks fine to me, and also compiles fine. What error are you receiving?
you should use code tags, it will make it easier to read, plus more people will respond
sorry, i had a bad version of c++.
my bad.