#include<iostream.h>
#include<stdio.h>
#include<conio.h>
void enterr();
void print();
void sorting();
int size;
float a[3][3];
void main ()
{
int clrscr();
cout<<"welcom to c++";
cout<<endl;
enterr();
print();
sorting();
cout<<"sorting of array";
print();
cout<<endl;
cout<<endl;
cout<<endl;
getchar();
}
void enterr()
{
size =3;
int x;
cout<<"if want change size of array to other size press<1>";
cin >>x;
if(x==1)
{
cout<<"please insert size of array=";
cin>> size;
}
for(int i=0;i< size;i++)
{
for(int j=0; j<size;j++)
{
cout<<"ENTER1 ARRAY["<<i<<"]["<<j<<"]"<<endl;
cin>>a[j];
}
}
}
void print ()
{
cout<<endl;
cout<<"=================";
cout<<"print array:";
cout<<"=================";
for(int i=0;i< size;i++)
{
cout<<" ]";
cout<<endl;
cout<<"[";
for(int j=0; j<size;j++)
cout<< " "<<a[j];
}
cout<<" ]" <<endl;
cout<<"==============================================";
cout <<endl;
}
void sorting ()
{
int n ,i ,j,temp ,temp2;
for(n=0;n<(size*size);n++)
for(i=0;i<size;i++)
{
for(j=0;j<size-1;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
if(a[size-1]>a[i+1][0]&&a[size-1]!=a[size-1][size-1])
{
temp2=a[size-1];
a[size-1]=a[i+1][0];
a[i+1][0]=temp2;
}
}
}
}مطلوب تصحيح الأخطاء
وظيفة البرنامج ادخال مصفوفة غير محدودة الحجم
وترتيبها