1.1程序改写 要求以数组为结构的程序改写为以指针为数据结构 解: //2009 Tonee hannsoft@163.com #include <iostream> using namespace std; class ARP { int m; int* p; public: ARP(int x[],int size) { m = size; p = new int [m]; for (int i =0;i<m;i++) { p[i]=x[i]; } } void delsame(); void show(); ~ARP() { delete [] p;// delete p??? } }; void ARP::show() { for(int i=0;i<m;i++) { cout<<p[i]<<"/t"; if((i + 1 ) % 5 == 0 ) cout<<endl; } cout<<endl; } void ARP::delsame() { int i,j; for(i=0;i<m-1;i++) { if(p[i]==p[i+1]) { for(j=i+1;j<m-1;j++) { p[j]=p[j+1]; } m --; i --; } } } int main() { int b[16] = {1,2,2,3,4,4,5,6,6,7,8,8,8,9,10,10}; ARP temp(b,sizeof(b)/sizeof(b[0])); temp.show(); temp.delsame(); temp.show(); return 0; } 我的目标是Cpp enginerr what about you?