الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

قهر 11 error بعد كل التعب والجهد

مغلق
بدأه برق ورعد في 10 أبريل 2006 · 5 رد · 524 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

[ قهر كتبت هالبرنامج وتعبت فيه واخرته يطلع لي 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);
}

تم تعديل هذه المشاركة بواسطة برق ورعد في 10 أبريل 2006 في 21:37

#2

هذا التعديل مافيه ولا ايرور, بس اظن عندك مشكله في الببل سورت انت حلها, لانه اغلاطك سخيفه جدا

#include <iostream.h>

class A

{

private:

public:

void size(int);

void resize(int ,int*);

void read (int*,int);

void bubble(int*,int);

void print (int * ,int);

};

void A::size(int x)

{

cout <<"the size is "<<x;

cout<<endl;

}

void A::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 A::read(int *tab ,int y)

{

for (int j=0;j<y;j++)

cin>>tab [j];

}

void A::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 A::print( int*tab , int y)

{

for (int k =0;k<y;k++)

{ cout <<tab[k];

cout <<endl;

}

}

void main()

{

A a;

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);

}

ENG. IMAD, Programing is a way of life, It's in the air, we breath It's pumps through our veines, Without it, we soon crumble to dust

#3

الله يوفقك دني واخرة اخوي جعل الله ما فعلت في ميزان حسناتك

#4

عذرا اخوي ما تنفذ لي الترتيب الفقاعي يطبع لي فقط الارقام المدخلة بدون ترتيب وش الحل ياليت ترد اليوم وشكرا لاني احتاجه بكرا ضروري

#5

هذا برنامج يعمل ترتيب فقاعي و يظهر النتائج, خذ الكود كوبي بيست

#include <iostream>

using namespace std;

void main()

{

int temp;

int a[5]={90,400,3,20,1};

for(int i=0;i<5;i++)

{

for(int j=0;j<5;j++)

{

if(a[j]>a[j+1])

{

temp=a[j];

a[j]=a[j+1];

a[j+1]=temp;

}

}

}

for(int o=0;o<5;o++)

{

cout<<a[o]<<" ";

}

cout<<endl;

}

ENG. IMAD, Programing is a way of life, It's in the air, we breath It's pumps through our veines, Without it, we soon crumble to dust

#6

مشكور وجزاك الله الف خير

هذا الموضوع مغلق.

مواضيع مشابهة