المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : ضرب وجمع مصفوفتين بالسي شارب matrix multiplicaion in c sharp


eshrag.net
08-07-2010, 08:43 AM
<div><div align="center">http://absba2.absba.org/teamwork4//New%20Logo/1-2.gif


http://absba2.absba.org/teamwork4//New%20Logo/yyyya9.gif

بداية لمراجعة المصفوفات

الدرس الثاني عشر

المصفوفات Arrays in c sharp
(http://www.absba.org/showpost.php?p=8890690&postcount=123)

ضرب وجمع المصفوفات تمرين شائع يعطى للمبتدئين في البرمجة ، وفي هذا الموضوع اقدم شرحا

للتمرينين على بيئة الكونسول.....

اولا جمع المصفوفات :
http://absba1.absba.org/teamwork16/582093/111022008151055524.jpg
لمراجعة كيفية جمع المصفوفات

http://www.visualstatistics.net/Scal...20addition.htm (http://www.visualstatistics.net/Scaling/Matrix%20Addition/Matrix%20addition.htm)


جمع المصفوفات سهل ومباشر ، يجب ان تكون المصفوفتين من نفس الابعاد ، في مثالنا كلا المصفوفتي 2*2
اولا نعرف مصفوفتين 2arrays من نوع int ونعطيهما قيم ، وايضا قمنا بعرضها على الشاشة ....
<div style="margin:20px; margin-top:5px"> كود PHP:
<div class="alt2"> <div dir="ltr" style="text-align:left;"> <span style="color: #000000"> namespace matrixaddition
{
class Program
{
static void Main(string[] args)
{
int[,] first = new int[2, 2] { { 2, 3 }, { 3, 5 } };
int[,] second = new int[2, 2] {{ 1, 1 }, { 3, 2 }};
int[,] result = new int[2, 2];
Console.WriteLine("--------------------------------");
Console.WriteLine("Elements of first array");
Console.WriteLine("--------------------------------");
for (int i = 0; i <span style="color: #007700"><span style="color: #000000"> Console.WriteLine("--------------------------------");
Console.WriteLine("Elements of resulting array of addition");
Console.WriteLine("--------------------------------");
for (int i = 0; i <span style="color: #007700"><span style="color: #000000"> class Program
{
static void Main(string[] args)
{
int[,] first = new int[2, 3] { {2, 2, 3},{ 1, 4, 2} };
int[,] second = new int[3, 2] {{ 8, 1},{ 5, 4},{ 6, 8} };
int[,] result = new int[2, 2];


Console.WriteLine("-------------------------------------------");

Console.WriteLine("Elements of first Array");

Console.WriteLine("-------------------------------------------");
for (int i = 0; i <span style="color: #007700"><span style="color: #000000"> for (int i = 0; i <span style="color: #007700">