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

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

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

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

Deprecated: Assigning the return value of new by reference is deprecated in /www/wwwroot/shabab.ps/public_html/vb/showthread.php on line 1523
إستفسـآر مساعدة رجاءا :( مين بيعرف اوبجيكت ؟ - منتديات شباب فلسطين
نحن مع غزة
قديم 04-29-2012, 09:01 PM   #1
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;


}
  اقتباس المشاركة
إضافة رد


الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1)
 
أدوات الموضوع
انواع عرض الموضوع

تعليمات المشاركة
لا تستطيع إضافة مواضيع جديدة
لا تستطيع الرد على المواضيع
لا تستطيع إرفاق ملفات
لا تستطيع تعديل مشاركاتك

BB code is متاحة
كود [IMG] متاحة
كود HTML معطلة

الانتقال السريع


الساعة الآن 11:15 AM.