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

سؤالين في arrays

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

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

عندي سؤالين حاولت احلهم وماعرفت في ال arrays !! .. وانا مبتديء في السي بلس بلس وادرسها بالجامعه وهذا اول ترم لي فيها .. المهم محتاج جواب لها لانه عندي يوم الثلاثاء اختبار ابغا افهم حلهم .. محتاج مساعدتكم

السؤال الاول :

write a program that multiplies two 3 x 3 arrays: arr1 and arr2 and puts the result in array arr3. The program should use a function that finds elements of arr3 by multiplying rows of arr1 by columns of arr2. (The function could be designed to receive an array representing elements of columns of arr2).

السؤال الثاني :

write a program that randomly fills a 4x4 array. There should be No duplicate numbers in that array. Numbers should range between 1-99. Use functions to build your program

وشاكرين لكم تعاونكم مقدما

#2

اللي فهمته ضرب مصفوفتين بالسؤال الاول

ازا ضرب مصفوفتين هيي الكود لو دورت بتلاقيه بمكتبه الاكواد

/index.php?showtopic=60513

تحياتي

52gv0m.gif
#3

الكود

#include <iostream.h>
#include <windows.h>
int main ()
{
int i,j,k,sum;
 int a[2][2],b[2][4];
 SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED|FOREGROUND_INTENSITY);
 for (i=0; i<2; i++)
{ 
  for (j=0; j<4; j++)
  {
   cout << "Enter for " << "a[" << i << "][" << j << "]" << " element  ";
   cin >> a[j];
  }
 }

 cout << endl << endl;
 for (i=0; i<2; i++)
 {
  for (j=0; j<4; j++)
  {
   cout << "Enter for" << "b[" << i << "][" << j << "]" << " element   ";
   cin >> b[j];
  }
 }
 cout <<  endl<< endl;
 cout << " *******************************************" << endl << endl;
 cout << "Now you see here that you typed for Matrix a" << endl << endl;
 cout << "********************************************" << endl << endl;

 for (i=0; i<2; i++)
 {
  for (j=0; j<4; j++)
  {
   cout << '\t'<<a[j] << '\t';
  }
  cout << endl << endl;
 }
 cout << endl << endl;
 cout << " *******************************************" << endl << endl;
 cout << "Now you see here that you typed for Matrix b" << endl<<endl;
 cout << "*********************************************" <<endl << endl;

 for (i=0; i<2; i++)
 {
  for (j=0; j<4; j++)
  {
   cout <<'\t'<< b[j] << '\t';
  }
  cout << endl << endl;
 }
 cout << "\n";
 cout << " ******************************************************" << endl << endl;
 cout << "Now you see here the multiplication of Matrix a and b" << endl<< endl;
 cout << "+******************************************************+" << endl << endl;
 for (i =0; i<2; i++)
 {
  for (j=0; j<4; j++)
  {
   sum = 0; 
   for (k=0; k<2; k++)
   {
    sum = sum + a[k] * b[k][j];
   }
   cout << '\t'<<sum << '\t';
  }
  cout << endl <<  endl;
  cout << endl<< endl;
 }
 return 0;
}

طبعا غير ابعاد المصفوفه على حسب ما هو مطلوب منك بالسؤال :lol: :lol:

لا تقلي مو فاهم :( :(

السؤال هييك بيقول :( :(

52gv0m.gif

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

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