[ قهر كتبت هالبرنامج وتعبت فيه واخرته يطلع لي 11 خطأ ليش؟؟مدري !!
وظيفة البرنامج هذا اعطاء حجم جدول ثم اعادة تحجيمه ثم قراءة عناصره وبعد ذلك يعمل له الترتيب الفقاعي (تصاعديا) ثم يطبعه
اتمنى ان تساعدوني في حل هذه الاخطاء مع خالص شكري وتقديري..
#include <iostream.h>
class A
{
private:
public:
size(int);
resize(int ,int*);
read (int*,int);
bubble(int*,int);
print (int * ,int);
}
void size(int x)
{
cout <<"the size is "<<x;
cout<<endl;
}
void resize (int y ,int *tab )
{
int *tab2;
tab2 =new int [y];
for (int i=0;i<y;i++)
tab2=tab;
tab =tab2;
delete []tab2;
cout <<"arry is resized by "<<y<<endl;
}
void read(int *tab ,int y)
{
for (int j=0;j<y;j++)
cin>>tab [j];
}
void bubble (int *tab ,int y)
{
int i,j;
int ex=1;
while(ex=0)
{
for (i=0;i<y-1;i++)
{
j=i+1;
while ((j<y)&&(tab <=tab[j]))
j++;
if ((tab >tab[j])&& (j<y))
{
int temp =tab;
tab =tab[j];
tab[j]=temp;
ex=1;
}
}
}
}
void print( int*tab , int y)
{
for (int k =0;k<y;k++)
{ cout <<tab[k];
cout <<endl;
}
}
void main()
{
int *tab;
int x,y;
cout<<"enter size"<<endl;
cin >>x;
tab =new int [x];
A.size(x)
cout <<"what is new size "<<endl;
cin >>y;
A.resize (y,*tab);
A.read(*tab,y );
cout <<"bubble sort is ";
A.bubble(*tab,y);
A.print(*tab,y);
}