Deprecated: Assigning the return value of new by reference is deprecated in /www/wwwroot/shabab.ps/public_html/vb/showpost.php on line 218

Deprecated: Assigning the return value of new by reference is deprecated in /www/wwwroot/shabab.ps/public_html/vb/showpost.php on line 223
منتديات شباب فلسطين - عرض مشاركة واحدة - إستفسـآر مساعدة رجاءا :( مين بيعرف اوبجيكت ؟
عرض مشاركة واحدة
قديم 04-29-2012, 09:01 PM   #4
Arabian girl
I ♥ PALESTINE
 
الصورة الرمزية Arabian girl
“Life is full of beauty. Notice it. Notice the bumble bee, the small child, and the smiling faces. Smell the rain, and feel the wind.
سبحان الله وبحمده.... سبحان الله العظيم ..

قوة السمعة: 103 Arabian girl will become famous soon enough

افتراضي رد: مساعدة رجاءا :( مين بيعرف اوبجيكت ؟

هيك صار تقريبا شكليا كامل بس بدو تعديل عشان تطلع النتيجة صح :P



#include <iostream>
using namespace std ;


class ArrayList
{
int size;
public :
int *list;

ArrayList();
ArrayList(int ) ;
void SetSize(int);
int GetSize();
void ReadArray();
void PrintArray();
int PositiveCount();
void copyPositiveValues(ArrayList obj1);
~ArrayList();
};


ArrayList::ArrayList(){size=5;};
ArrayList::ArrayList(int n){size=n;}
void ArrayList::SetSize(int S ){size=S;}

int ArrayList::GetSize(){return 6 ;}

void ArrayList::ReadArray(){
int num; for (int i=0 ; i<size ; i++)
{
cin >>num;
list[i]= num ;}
}

void ArrayList::PrintArray(){ for (int i=0 ; i < size ; i++)
cout <<list[i]<<" ";}


int ArrayList::PositiveCount(){int Pcount=0 ; for(int i =0;i<size ; i++)
{
if (list[i] >= 0)
Pcount++;

}
return Pcount;
}


void ArrayList::copyPositiveValues(Array List obj1)
{
obj1.list;
for (int i=0; i<size ; i++)
{
if (list[i]>=0)
cout <<list[i] <<" " ;
}
cout <<endl;
}

ArrayList::~ArrayList(){ }



void main ()
{
ArrayList list[6];
cout <<"please Enter 6 values to fill the List :";

list[6].list=new int [6];
list[6].ReadArray();
cout<<"the content of the first array are : ";
list[6].PrintArray();
cout<<endl;
cout <<"the number of the positive values inside the first list is "<<list[6].PositiveCount()<<endl;
int size;
size =list[6].PositiveCount();

ArrayList List(size);
List.copyPositiveValues(list[6]);
cout <<"The size of the second list is :" << size<<endl;


}
  اقتباس المشاركة