I don't know why the programm is error.I think that is right.who can help me .thank you!!!
#include<iostream>
using namespace std;
int main(){
int N,k=1,x=0,j=0;
cin>>N;
int*a=new int[N];
int*b=new int[N];
int*c=new int[N];
for(int o=0;o<N;o++)
b[o]=c[o]=1;
for(int i=0;i<N;i++)
cin>>a[i];
for(int m=0;m<N-1;m++)
for(int n=m+1;n<N;n++){
int temp;
if(a[m]>a[n]){
temp=a[m];
a[m]=a[n];
a[n]=temp;
}
}
while(j<N-1){
c[x]=a[j];
while(a[j]==a[k]&&k<N){
b[x]++;
k++;
}
j=k;
k++;
x++;
}
if(k==N&&j==N-1){
c[x]=a[j];
}
for(int v=0;v<=x;v++)
cout<<b[v]<<" "<<c[v]<<" ";
cout<<endl;
return 0;
}