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

ارحمو من في الأرض يرحمكم من في السماء

مغلق
بدأه jasmen في 22 ديسمبر 2003 · 2 رد · 516 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم....

ارحموا من في الأرض يرحمكم من في السماء...

اخواني ابيكم اتساعدوني فحل هالمسالتين اللي والله اني مب فاهمنتهم و ياتنا اليوم في الإمتحان و ارجوكم ساعدوني....!!!

problem1
initialize a two dimensional float array x of 20 rows (i) and 20 coloums(j) so that each element at row (i) and coloum (j) =(i-j) /(i+j)  . write a c++ function maxmin() that finds the largest and smallest value in the array and  display the result on screen using a seperate function display and

و هذا حلي اللي شاكة انه مليون في المية غلط....

#include <iostream>
using namespace std;

void display(float [][4],int);
void SumRowCol(float [][4],int);

int main ()
{
	float x[4][4];



	for (int i=0; i<4; i++)
	{
  for(int j=0; j<4; j++)
  {
 	 cout<<"Element at position [" <<i<< ", " <<j<<" ] is:";
 	 cin>> x[j];
  }
  

  display(x,4);
  sumRowCol(x,4);
	}
	return 0;
}

void display(float  x[][4],int size)
{
	for (int i=0; i<4; i++)
	{
  for(int j=0; j<4; j++)
  
  {cout<<"\n\nElement at position [" <<i<< ", " <<j<<" ] is:" <<x[j]<<endl;}
 	 
 	 
	}
}
void SumRowCol(float x[][4],int size)
{
	int sum-row ,sum_col=0;
	for(int i=0; i<4;i++)
	{
  sum_row=0;
  sum_col=0;
  for(int j=0; j<4; j++)
  {
 	 sum_row =sum_row+x[j];
           sum_col =sum_col+x[j];
  }
  cout<<"n\nSum of Row "<<i<<" is "<<sum_row<<endl;
        cout<<"n\nSum of Colum "<<i<<" is "<<sum_col<<endl;

	}

تم تعديل هذه المشاركة بواسطة cold0zero في 23 ديسمبر 2003 في 03:23

#2

شوفي حبيبتي هذا بدون اخطاء

بس النواتج خطا اتاكدي من الاقواس و بحاول ارجع احلها.

#include <iostream>
using namespace std;

void display(float [][4],int);
void SumRowCol(float [][4],int);

int main ()
{
float x[4][4];



for (int i=0; i<4; i++)
{
for(int j=0; j<4; j++)
{
cout<<"Element at position [" <<i<< ", " <<j<<" ] is:";
cin>> x[j];
}


display(x,4);
SumRowCol(x,4);
}
return 0;
}

void display(float x[][4],int size)
{
for (int i=0; i<4; i++)
{
for(int j=0; j<4; j++)

{cout<<"\n\nElement at position [" <<i<< ", " <<j<<" ] is:" <<x[j]<<endl;}


}
}
void SumRowCol(float x[][4],int size)
{
int sum_row;
int  sum_col=0;
for(int i=0; i<4;i++)
{
sum_row=0;
sum_col=0;
for(int j=0; j<4; j++)
{
sum_row =sum_row+x[j];
sum_col =sum_col+x[j];
}
}
cout<<"n\nSum of Row "<<i<<" is "<<sum_row<<endl;
cout<<"n\nSum of Colum "<<i<<" is "<<sum_col<<endl;

}

تم تعديل هذه المشاركة بواسطة cold0zero في 23 ديسمبر 2003 في 03:25

#3

السلام عليكم,

سأعطيك المحاواة التالية سندخل الأرقام araays وقد استعملت في هدا المثال 4*4 ويمكن تغيير هدا كما نريد وبعد أن نخل هده الأرقام يعطينا الأكبر والأصغر بين هده الأرقام

#include <iostream.h>
void Display(float,float);
void main()
{
	float flt[4][4];
	for(int i=0;i<4;i++)
	{
  for(int j=0;j<4;j++)
  {
 	 cout << "Enter number ["<<i<<"] and ["<<j<<"]\n";
 	 cin >> flt[j];
  }
	}
	float TheMax=flt[0][0];
	float TheMin=flt[0][0];
	for(i=0;i<4;i++)
	{
  for(int j=0;j<4;j++)
  {
 	 if(flt[j]>TheMax) 
    TheMax=flt[j];
 	 if(TheMin>flt[j])
    TheMin=flt[j];
  }
	}
	Display(TheMax,TheMin);
}
void Display(float mx,float mn)
{
	cout <<"\n\n";
	cout <<"The max is : "<<mx <<" And  The Min is : "<<mn <<"\n\n";
}

إلى اللقاء.

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

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