A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/premierconsult/public_html/index.php:65)

Filename: core/Input.php

Line Number: 408

A PHP Error was encountered

Severity: Warning

Message: session_start(): Cannot send session cookie - headers already sent by (output started at /home/premierconsult/public_html/index.php:65)

Filename: Session/Session.php

Line Number: 143

A PHP Error was encountered

Severity: Warning

Message: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/premierconsult/public_html/index.php:65)

Filename: Session/Session.php

Line Number: 143

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/premierconsult/public_html/index.php:65)

Filename: controllers/Questions.php

Line Number: 330

برنامج يحدد المستخدم ابعاد مصفوفة ثنائية مربعة , ومن ثم يقوم البرنامج بطباعة مجموع عناصر القطر الرئيسي للمصفوفة c++

برنامج يحدد المستخدم ابعاد مصفوفة ثنائية مربعة , ومن ثم يقوم البرنامج بطباعة مجموع عناصر القطر الرئيسي للمصفوفة c++


برنامج يحدد المستخدم ابعاد مصفوفة ثنائية مربعة  ,  ومن ثم يقوم البرنامج بطباعة مجموع عناصر القطر الرئيسي للمصفوفة c++ :

الأجوبة

#include
void main ( )
{
 // initialize tow dimensional array
 int Array [10] [10] ;
// size of array
 int Dim;
 //total numbers which have same dimension
 int Total = 0 ;
 // input phase
 cout << "Enter the Dim of Array : " ;
 cin >> Dim ;
 // loop until loop counter equal to array dimension
 for (int Counter_1 = 0; Counter_1 < Dim; Counter_1 ++)
 {
 // loop until loop counter equal to array dimension
 for (int Counter_2 = 0; Counter_2 < Dim; Counter_2 ++ )
 {
 // input phase
 cout << "Enter the element ["
 << Counter_1
 << "] [" << Counter_2
 << "] : ";
 cin >> Array [Counter_1] [Counter_2];
 // if row number equal to column number
 if ( Counter_1 == Counter_2)
 Total += Array [Counter_1] [Counter_2] * Array [Counter_1]
 [Counter_2];
 }
 } // end for
 // display result
 cout << "The result is : " << Total;
} // end main
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...