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

*!* مكتبة اكواد سي ++ والبرامج الجاهزه *!*

مغلقرائج
بدأه Eng.C# في 24 مارس 2005 · 69 رد · 13,603 مشاهدة · في لغة C و ++C
مشاركة: واتساب X فيسبوك تيليجرام
#27

كود draw the diamond using nested for loop

/////////////////////////////////////////////////////////////////////
///   This program is to draw the diamond using nested for loop   ///
/////////////////////////////////////////////////////////////////////
#include<iostream>
using namespace std;
void main()
{

    int size;
    cout<<"enter any odd number (number of lines) :  ";
    cin>>size;

// The first step is to draw a triangle.

	for(int i=1;i<=size;i++)
	{
  for(int j=1;j<=size-i;j++)
 	 cout<<" ";
  for(int k=1;k<=2*i-1;k++)
 	 cout<<"*";
  cout<<endl;
	}

// The second step is to draw a reverse triangle.

    for( int n=(size-1);n>=1;n--)
	{
  for(int l=1;l<=size-n;l++)
 	 cout<<" ";
  for( int m=1;m<=2*n-1;m++)
 	 cout<<"*";
  cout<<endl;
	}
	cout<<endl;
}

12.gif

cs.jpg

#28

كود Fibonacci Sequence without recursive

///////////////////////////////////////////////////////////////
///// Fibonacci Sequence without recursive/////////////////////
///////////////////////////////////////////////////////////////

#include<iostream>
using namespace std;

void fibonacci(int );
void main()
{
	int nt;
	cout<<"Enter number of terms";
	cin>>nt;
	fibonacci(nt);
}

void fibonacci(int x)
{
	int next,t1=0, t2=1;
    cout<<t1<<"  "<<t2<<"  ";
	for(int i=0; i<=x;i++)
	{
  next=t1+t2;
  cout<<next<<"  ";
  t1=t2;
  t2=next;
	}
	cout<<endl;
}

12.gif

cs.jpg

#29

كود لحساب مساحه مثلث ..

////////////////////////////////////////////////////////////////////
//////////             Area of triangle
////////////////////////////////////////////////////////////////////

#include<iostream>
using namespace std;
#include<cmath>
double Area_of_Triangle(double, double, double);  //function prototype
const double Pi=22.0/7.0;
void main()
{
	double side1, side2, angle, result;
	cout<<"Input the values of two sides (side1, side2) : "<<endl;
	cin>>side1>>side2;
	cout<<"Input the value of the angle between side1 and side2 : "<<endl;
	cin>>angle;
	angle=angle*(Pi/180.0);  //change from degree to radian
	result=Area_of_Triangle(side1,side2,angle);  //calling function
	cout<<"The area of triangle is : "<<result<<endl;
}

double Area_of_Triangle(double s1, double s2, double ang)  //function decleration
{
	double a;
	a=0.5*s1*s2*sin(ang);
	return a;
}

12.gif

cs.jpg

#30

وين مشاركاتكوا يا شباب ؟؟؟

12.gif

cs.jpg

#31

""""a=0.5*s1*s2*sin(ang);""""

مثالك الاخير هو ما كنت ابحث عنه

الف شكر اخوي..

logo1.png تطبيق طمأنينة ، نسخة بيتا على أندرويد

عبدالله الشمّري - Al-Shammari

CodingAlone.com

twitter @abshammeri

abshammeri AT gmail.com

github : abshammeri

#32

لا شكر على واجب ... :rolleyes: :rolleyes:

12.gif

cs.jpg

#33

كود تحويل من text ال binary

#include <iostream>
using namespace std;
#include <cstring>
#include <cstdlib>

char *entry, letter, choice[2];
int ascii, len, binary[8], total;
void prog();

int main()
{
      prog();     
      return 0;
}        
        
void prog()
{
   entry = new char[501]; 
   /* entry should be dynamic, otherwise a new 
      string entry of 501 chars would be created
      each time function is called!  
      Talk about memory hog! */
   cout<<"Enter string to convert (up to 500 chars): ";
   cin.getline(entry, 500);
   len = strlen(entry);  /* get the number of characters in entry. */
   /* this loop is executed for each letter in the string. */
   for(int i = 0; i<len; i++)
   {
      total = 0;
      letter = entry; /* store the first letter */
      ascii = letter;    /* put that letter into an int, so we can 
                            see its ASCII number */ 
      while(ascii>0) /* This while loop converts the ASCII # into binary,
                        stores it backwards into the binary array. */
      {
         /* To get the binary code one must take the decimal number in
            question, take it and divide it by two repeatedly, save
            the remainder (which will become the binary number), save
            the whole number, divide by two, and repeat the whole
            process until 0 is reached.  This if-else statement serves
            this functionality, by getting the remainder of the ascii
            code, storing it in the array and then dividing the int
            ascii by two */
         if((ascii%2)==0)
         {
            binary[total] = 0;
            ascii = ascii/2;
            total++; /* increasing by one each time will yeild the
                        number of numbers in the array. */
         }
         else
         {
            binary[total] = 1;
            ascii = ascii/2;
            total++;
         }
      }
      total--; /* due to data type factors, the program will actually
                  add a 0 at the end of the array that is not supposed
                  to be there, decrementing total will solve this
                  problem, as that 0 will not be displayed. */
      /* this while loop displays the binary code for that letter. */
      while(total>=0)
      {
         cout<<binary[total];
         total--;
      }
   }
   delete[] entry; /* free up the memory used by entry */
   cout<<endl<<"Do again(1 = yes, 2= no)?: ";
   cin.getline(choice,3);
   if(choice[0] == '1')
      prog(); /* program is recursive, it calls itself.  It's kinda
                 like a function loop of sorts. */
   else
      exit(0); /* quits the program */  
}

12.gif

cs.jpg

#34

السلام عليكم و رحمه الله ..

أرجو من المشرف العام على منتدى ++C

أن يقوم بتثبيت الموضوع ..

كما أرجو من بقيه الأعضاء المساهمه بالموضوع ..

و دمتم ..

12.gif

cs.jpg

#36

ماشاء الله عليك اخي رااائع

noor_cs ان شاء الله يتم تثبيت الموضوع

وبالقريب حانزل اكوااد

مشكووور على مساهمتك

52gv0m.gif
#37

ضرب مصفوفتين

#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;
}
52gv0m.gif
#38

يقوم بحساب شهر واحد من السنه

#include < iostream.h>
#include<windows.h>
#include<conio.h>
void year ( void );
void month ( void );
void show_calendar ( int n  );
unsigned long days=0;
int mm,dd,i,k;
void main ()
{
	cout << " Welcome  calendar  ";
	year ();
	month ();



}
void year ( void )
{
	cout << " enter th year ";
	cin >> mm;
	for ( i=2005;i<mm;i++)
	{
  if ( mm%4==0)
 	 days+=366;
 	 else 
    days+=365;
  
	}
}
void month ( void )
{
	cout << " enter the month plz ";
	cin >>dd;
	for ( i=dd;i<12;i++)
	{
  if ( i==1 && i==3 && i==5 && i==7 && i==8 &&i==10 && i==12 )
  { 
 	 days+=31;
  }
  if ( i==4 && i==6 && i==9 && i==11 )
  {
 	 days+=30;
  }
  if ( i==2 && mm%4==0)
 	 days+=29;
 	 else 
    days+=28;
  
	}

  if ( i==1 && i==3 && i==5 && i==7 && i==8 &&i==10 && i==12 )
  {  
 	 show_calendar ( 31 );
  }
  if ( i==4 && i==6 && i==9 && i==11 )
  {
 	 show_calendar ( 30 );
  }
  if ( i==2 && mm%4==0)
  
 	 show_calendar ( 29 );
 	 else 
    show_calendar ( 28 );;
  
}
void show_calendar ( int n  )
{
	system("cls");
	int row=5 ;  
	cout << "     Saturday           Sunday          Monday        tuesday        Wednesday        Thrusday      friday  \n " << endl;
	cout << " ----------------------------------------------------------------------------------------------------------- \n ";
	for ( i=1;i<=n;i++,days++ )
	{
  k=days%7;
  cout << "        " << i << " \t";
  if ( i==7 || i==14 || i==21 || i==28 || i==35 )
   cout << endl;

  if(k==6)
   row++;
	}
}
52gv0m.gif
#39
نوري_86 كتب:
ماشاء الله عليك اخي رااائع

noor_cs  ان شاء الله يتم تثبيت الموضوع

وبالقريب حانزل اكوااد

مشكووور على مساهمتك

لا شكر على واجب أخي الكريم ..

لكن المهم هو المساهمه الفاعله بالموضوع .. للجميع

12.gif

cs.jpg

#40

برنامج يحسبلك الفرق بالايام بين اي تاريخين

يعني التاريخ الاول 13\2

التاريخ الثاني 26\4

عدد الايام بين التاريخين = 72

البرنامج

#include <iostream.h>

int Calender (int,int);
int calender2 (int,int);
void main ()
{
	cout << endl<< endl;
    int month1 , day1 ,month2,day2 ,sum;
    cout << " Day1=";
    cin>> day1;
    cout << " Month1=";
    cin>> month1;
	cout << " day2=";cin>>day2;
	cout << " month2=";cin>>month2;
    cout << endl;
    cout << " The Days From input user date 1: "  <<    Calender ( month1 , day1)  << " Days"<< endl;
    cout << endl<<endl;
     cout << " The Days Frominput user date 2: "  <<    calender2 ( month2 , day2)  << " Days"<< endl;
  sum =  Calender ( month2 , day2) - calender2 ( month1 , day1);
  cout << sum;
    cout << endl<<endl;
    cout << "                           **********************************  " << endl<< endl;
}
int Calender ( int month1,int day1 )
{
    int x[] = {31 ,28 ,31 ,30 ,31 ,30 ,31 ,31 ,30 , 31 ,30 ,31};
    int temp = 0;
    for( int i=0; i<month1-1; i++)
    temp += x;
    return  temp + day1;
}
int calender2 (int month2,int day2)
{
   int x[] = {31 ,28 ,31 ,30 ,31 ,30 ,31 ,31 ,30 , 31 ,30 ,31};
    int temp = 0;
    for(int i=0; i<month2-1; i++)
    temp += x;
    return  temp + day2;
}
52gv0m.gif
#41

بسبسم الله الرحمن الرحيم

الاخوة

noor_cs

احمد غريب

نوري

مشكورييييييييييييييييييييييين الف الف الف شكر وجزاكم الله عنا الف الف خير ومزيد من الابداع والتقدم والتألق يا افضل اساتذة عرفتهم

الى الامــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــام

عصام عبد الله

هندسة الكترونية واتصالات

اليمن/ جامعة عدن

#42

بسم الله الرحمن الرحيم

الاخوة:

noor_cs

نوري

احمد الغريب

تحية شكر وتقدير لجهودكم المبذولة في المنتدى ونقول جزاكم الله الف الف خير والى الامام والى المزيد

من التألق والابداع ومزيد من البرامج والفكر الجيدة والســـــــــــــــــــــــــــــلام :lol:

عصام عبد الله (h)

اليمن

هندسة الكترونية واتصالات\جامعة عدن

#43

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

هذا البرنامج بيختبر العدد اللي يدخله اليوزر اذا كان عدد اولي ولا ليس

عدد اولي...........

#include<iostream.h>
void main()
{
int divide=0,number;
cout<<"Enter the number for test: ";
cin>>number;
cout<<endl;
for(int count=2; count<number; count++)
{
if(number==(number/count)*count)
divide=divide+1;
}
if(divide==0)
cout<<"The number you entered is prime.";
else
cout<<"The number you entered is not prime.";
}
#44
عصام اليماني كتب:
بسم الله الرحمن الرحيم

الاخوة:

noor_cs

نوري

احمد الغريب

تحية  شكر وتقدير لجهودكم المبذولة في المنتدى  ونقول جزاكم الله الف الف خير والى الامام والى المزيد

من التألق والابداع ومزيد من البرامج والفكر الجيدة  والســـــــــــــــــــــــــــــلام :lol:

عصام عبد الله (h)

اليمن

هندسة الكترونية واتصالات\جامعة عدن

مشكووور اخي على مرورك الراائع

وان شاء الله نشوف المزيد من االاكواد اللي حتفيد الجميع

تحياتي

52gv0m.gif
#45

logo

مشكوور اخي على هذا الكود

وتحياتي

52gv0m.gif
#46

calendar full any year

#include <iostream.h>
#include <windows.h>
void month1 ( void );
void week1 ( void );
void day1 ( int y);
int loop1 ( int x );
int daystart , year;
 int s[12]={31,28,31,30,31,30,31,31,30,31,30,31};
void main  ()
{
  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED|FOREGROUND_INTENSITY);
 cout << " enter the year :>>  ";
 cin >> year;
 cout << endl<< endl;
 cout << " enter the daystart in the year "<< year << endl;
 cout << " sunday   =1" << endl;
 cout << " monday   =2" << endl;
 cout << " tusday   =3" << endl;
 cout << " wednesday=4" << endl;
 cout << " thuresday=5" << endl;
 cout << " friday   =6" << endl;
 cout << " saturday =7" << endl;
 cout << " the day is : >> ";
 cin >> daystart;
 cout << endl<< endl;
 cout << " ***************************************************** "<< endl;
 cout << "                    THE CALENDAR "<<year<<endl;
 month1 ();
 cout << " ***************************************************** " << endl;
}
void week1 ( void )
{
 cout << "\tsun     mon    tues    wed     thur    fri    sat   "<< endl;
} 
int loop1( int x)
{
  if ( year%4==0)
	{	
	int s[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	}
	else 
	{
	int s[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	}
	return 0;
}
void day1 ( int y )
{
	int count=0;
  int loop,i,x;
	if (y==1)
	{
   x=loop1( year );
   loop=s[y]+x;
  }
   else
  {
   loop=s[y];
  }
  for ( i=1;i<daystart;i++)
  {

  cout<<'\t';
  count++;
  }
	for (i=1;i<=loop;i++)
	{
  cout <<"\t" << i;
  count++;
	if ( count==7)
  {
   cout << endl;
   count=0;
	}
	}
	daystart=count+1;
  cout << endl;
}
void month1 ()
{
	//***************************************************
	cout << " __________________________________________________________"<< endl;
	cout << '\t'<<'\t'<<'\t'<< "<<January>>"<< endl<<endl;
	week1 ();
	day1 (0);
	//***************************************************
	cout << " __________________________________________________________"<< endl;
	cout <<'\t'<<'\t'<<'\t'<< "<<February>>"<< endl<<endl;
	week1 ();
	day1 (1);
	//***************************************************
	cout << " __________________________________________________________"<< endl;
	cout <<'\t'<<'\t'<<'\t'<<  "<<March>>"<< endl <<endl;
	week1 ();
	day1(2);
	//***************************************************
	cout << " __________________________________________________________"<< endl;
	cout <<'\t'<<'\t'<<'\t'<<  "<<April>>"<< endl<<endl;
	week1();
	day1 (3);
	//***************************************************
	cout << " __________________________________________________________"<< endl;
	cout << '\t'<<'\t'<<'\t'<<  "  << May >>"<< endl<<endl; 
	week1 ();
	day1 (4);
	//***************************************************
	cout << " __________________________________________________________"<< endl;
	cout <<'\t'<<'\t'<<'\t'<< " <<June>>"<< endl<<endl;
	week1 ();
	day1 (5);
	//***************************************************
	cout << " __________________________________________________________"<< endl;
	cout <<'\t'<<'\t'<<'\t'<< " <<July>>"<< endl<<endl;
	week1();
	day1 (6);
	//***************************************************
	cout << " __________________________________________________________"<< endl;
	cout << '\t'<<'\t'<<'\t'<< " <<August>> "<< endl<<endl;
	week1 ();
	day1 (7);
	//***************************************************
	cout << " __________________________________________________________"<< endl;
	cout <<'\t'<<'\t'<<'\t'<< " <<September>>"<< endl<<endl;
	week1();
	day1 (8);
	//***************************************************
	cout << " __________________________________________________________"<< endl;
	cout <<'\t'<<'\t'<<'\t'<< " <<October>>"<< endl<<endl;
	week1 ();
	day1 (9);
	//***************************************************
	cout << " __________________________________________________________"<< endl;
	cout <<'\t'<<'\t'<<'\t'<< " <<November>>"<< endl<<endl;
	week1 ();
	day1 (10);
	cout << endl;
	//***************************************************
	cout << " __________________________________________________________"<< endl;
	cout << '\t'<<'\t'<<'\t'<< " <<December>>"<< endl<<endl;
	week1 ();
	day1 (11);
	//***************************************************
}
52gv0m.gif
#47

برنامج phone book

كي يعمل البرنامج تحتاج الى فتح مفكره باسم DUMMY

#include <string.h>
#include <iostream.h>
#include <fstream.h>
#include <conio.h>

void Add();
void Delete();
void Find_By_Name();
void Find_By_Tel();
fstream fin;

int main()
{
   int c;
   fin.open("DUMMY.txt");
   if(!fin)   {
    cout<<"Cannot open the file (DUMMY.FIL).\n";   return 1; }

	while (1)
	{
  cout<<"\n1- add name            2- delete";
  cout<<"\n3- search by name      4- search by telephone : ";
  cin>>c;

    if (c==1) Add();     else if (c==2) Delete();
  else if (c==3) Find_By_Name(); else if (c==4) Find_By_Tel();
	else break;
	}

   fin.close();
   getche();
   return 0;
}


////////////////////////////////////////////////////////////////////////
void Add()
{
	char n[255],t[255];
	cin.ignore(255,'\n');
	cout<<"enter the name : "; 	 cin.getline(n,255); 
	cout<<"enter the telephone : ";  cin.getline(t,255); 
	fin<<n<<","<<t<<"\n";
}

void Delete()
{
   char buf[255];
	cin.ignore(255,'\n');
	cout<<"enter the name : ";
	cin.getline(buf,255);
	string s1;  s1=buf;
	int found = 0;
	while (fin.getline(buf,255))   
	{
    string s2(buf,0,s1.length());
       if (s1.compare(s2)==0)  
    {
     cout<<"\nname and telephone respectively are :  "<<buf<<" **(will deleted)**\n";
     fin<<"**************************";
     found++;
    }
	}
	if (found==0) cout<<"\nthis name not found ...\n";
}

void Find_By_Name()
{
   char buf[255];
	cin.ignore(255,'\n');
	cout<<"enter the name : ";
	cin.getline(buf,255);
	string s1;  s1=buf;
	int found = 0;
	while (fin.getline(buf,255))   
	{
    string s2(buf,0,s1.length());
       if (s1.compare(s2)==0)  
    {
     cout<<"\nname and telephone respectively are :  "<<buf;
     found++;
    }
	}
	if (found==0) cout<<"\nthis name not found ...\n";
}


void Find_By_Tel()
{
   char buf[255];
   cout<<"enter the telephone : ";
   string s1; cin>>s1;
   int found = 0;
   while (fin.getline(buf,255))   
   {
    int i=0;
    while ( (i<255) && (buf!=',') ) i++;
    string s2(buf,i+1, s1.length());
   	 if (s1.compare(s2)==0)  
  {
 	 cout<<"\nname and telephone respectively are :  "<<buf<<" \n";  
 	 found++;
  }
   }
   if (found==0) cout<<"\nthis name not found ...\n";
}
52gv0m.gif
#48

لا شكر على واجب........

بس انا بحب اوضح للاخ نوري_86 انو انا بنت مو ولد...

وباشكر كل اللي شاركوا والى الامام ........... وان شاء الله

راح اكتب كمان اكواد بس هلأ عندي امتحانات......

ادعولنا...........

#49
logo كتب:
لا شكر على واجب........

بس انا بحب اوضح للاخ نوري_86 انو انا بنت مو ولد...

وباشكر كل اللي شاركوا والى الامام ........... وان شاء الله

راح اكتب كمان اكواد بس هلأ عندي امتحانات......

ادعولنا...........

فيكي الخير والبركه اختي

وبالتوفيق بامتحاناتك

وان شاء الله نشوف منك المزيد من الاكواد

52gv0m.gif
#50

السلام عليكم

هذه اول مشاركه لي وهي برنامج حاصل ضرب مصفوفتين ذو الرتب (2*2)*(2*2) و (4*4)*(4*4) و(6*6)*(6*6)

#include <iostream.h>
#include <iomanip.h>
int main()
{
	int x[109],a,b,c,d,e,f,MatrixRank;
	cout<<"((((( Welcome To Matrix Program )))))";
	cout<<"Enter Your Matrix Rank"<<endl
     <<"1.(2*2) Matrix\n"
     <<"2.(4*4) Matrix\n"
     <<"3.(6*6) Matrix\n"
  <<"4.Exit\n";
	cin>>MatrixRank;
	while (MatrixRank!=3)
	{
  switch(MatrixRank)
  {
  case 1:
 	 cout<<"Welcome To (2*2) Matrix Rank Maltiplication\n";
 	 cout<<"x1   x2\n"
    <<"x3   x4\n";
 	 for(a=1;a<5;a++)
 	 {
    cout<<"Enter x"<<a<<"Number(The First Matrix):\t";
    cin>>x[a];
 	 }
 	 cout<<x[1]<<setw(4)<<x[2]<<endl
    <<x[3]<<setw(4)<<x[4]<<endl;
 	 cout<<"(The Second Matrix)\n"
    <<"x5   x6\n"
    <<"x7   x8\n";
 	 for(b=5;b<9;b++)
 	 {
    cout<<"Enter x"<<b<<"Number(The Second Matrix):";
    cin>>x;
 	 }
 	 cout<<x[5]<<setw(4)<<x[6]<<endl
    <<x[7]<<setw(4)<<x[8]<<endl;
 	 x[9]=(x[1]*x[5])+(x[2]*x[7]);
 	 x[10]=(x[1]*x[6])+(x[2]*x[8]);
            x[11]=(x[3]*x[5])+(x[4]*x[7]);
            x[12]=(x[3]*x[6])+(x[4]*x[8]);
 	 cout<<"Matrix 1 * Matrix 2=\n"
    <<x[9]<<setw(4)<<x[10]<<endl
    <<x[11]<<setw(4)<<x[12]<<endl;
 	 break;
  case 2:
 	 cout<<"Welcome To (4*4) Matrix Rank Maltiplication\n";
 	 cout<<"First Matrix"<<endl
    <<"x1   x2   x3   x4\n"
    <<"x5   x6   x7   x8\n"
    <<"x9    x10  x11  x12\n"
    <<"x13   x14  x15  x16\n";
    for (c=1;c<17;c++)
    {
   	 cout<<"Enter x"<<c<<"Number (First Matrix):\t";
   	 cin>>x[c];
    }
 	 cout<<"x[1]<<setw(4)<<x[2]<<setw(4)<<x[3]<<setw(4)<<x[4]\n"
    <<"x[5]<<setw(4)<<x[6]<<setw(4)<<x[7]<<setw(4)<<x[8]\n"
    <<"x[9]<<setw(4)<<x[10]<<setw(4)<<x[11]<<setw(4)<<x[12]\n"
    <<"x[13]<<setw(4)<<x[14]<<setw(4)<<x[15]<<setw(4)<<x[16]\n";
 	 cout<<"Number (Second Matrix)\n"
    <<"x17   x18   x19   x20\n"
    <<"x21   x22   x23   x24\n"
    <<"x25   x26   x27   x28\n"
    <<"x29   x30   x31   x32\n";
    for (d=17;d<33;d++)
    {
   	 cout<<"Enter x"<<d<<"Number (Second Matrix):\t";
   	 cin>>x[d];
    }
 	 cout<<"x[17]<<setw(4)<<x[18]<<setw(4)<<x[19]<<setw(4)<<x[20]\n"
    <<"x[21]<<setw(4)<<x[22]<<setw(4)<<x[23]<<setw(4)<<x[24]\n"
    <<"x[25]<<setw(4)<<x[26]<<setw(4)<<x[27]<<setw(4)<<x[28]\n"
    <<"x[29]<<setw(4)<<x[30]<<setw(4)<<x[31]<<setw(4)<<x[32]\n";
 	 x[33]=(x[1]*x[17])+(x[2]*x[21])+(x[3]*x[25])+(x[4]*x[29]);
            x[34]=(x[1]*x[18])+(x[2]*x[22])+(x[3]*x[26])+(x[4]*x[30]);
            x[35]=(x[1]*x[19])+(x[2]*x[23])+(x[3]*x[27])+(x[4]*x[31]);
            x[36]=(x[1]*x[20])+(x[2]*x[24])+(x[3]*x[28])+(x[4]*x[32]);
            x[37]=(x[5]*x[17])+(x[6]*x[21])+(x[7]*x[25])+(x[8]*x[29]);
            x[38]=(x[5]*x[18])+(x[6]*x[22])+(x[7]*x[26])+(x[8]*x[30]);
            x[39]=(x[5]*x[19])+(x[6]*x[23])+(x[7]*x[27])+(x[8]*x[31]);
            x[40]=(x[5]*x[20])+(x[6]*x[24])+(x[7]*x[28])+(x[8]*x[32]);
            x[41]=(x[9]*x[17])+(x[10]*x[21])+(x[11]*x[25])+(x[12]*x[29]);
            x[42]=(x[9]*x[18])+(x[10]*x[22])+(x[11]*x[26])+(x[12]*x[30]);
            x[43]=(x[9]*x[19])+(x[10]*x[23])+(x[11]*x[27])+(x[12]*x[31]);
            x[44]=(x[9]*x[20])+(x[10]*x[24])+(x[11]*x[28])+(x[12]*x[32]);
            x[45]=(x[13]*x[17])+(x[14]*x[21])+(x[15]*x[25])+(x[16]*x[29]);
            x[46]=(x[13]*x[18])+(x[14]*x[22])+(x[15]*x[26])+(x[16]*x[30]);
            x[45]=(x[13]*x[19])+(x[14]*x[23])+(x[15]*x[27])+(x[16]*x[31]);
            x[45]=(x[13]*x[20])+(x[14]*x[24])+(x[15]*x[28])+(x[16]*x[32]);
 	 cout<<"Matrix 1 * Matrix 2 = \n";
 	 cout<<x[33]<<setw(4)<<x[34]<<setw(4)<<x[35]<<setw(4)<<x[36]<<endl
                <<x[37]<<setw(4)<<x[38]<<setw(4)<<x[39]<<setw(4)<<x[40]<<endl
                <<x[41]<<setw(4)<<x[42]<<setw(4)<<x[43]<<setw(4)<<x[44]<<endl
                <<x[45]<<setw(4)<<x[46]<<setw(4)<<x[47]<<setw(4)<<x[48]<<endl;
  break;
  case 3:
            cout<<"Welcome To (6*6) Matrix Rank Maltiplication\n";
 	 cout<<"First Matrix"<<endl
    <<"x1   x2   x3   x4    x5    x6\n"
    <<"x7   x8   x9   x10   x11   x12\n"
    <<"x13  x14  x15  x16   x17   x18\n"
    <<"x19  x20  x21  x22   x23   x24\n"
    <<"x25  x26  x27  x28   x29   x30\n"
    <<"x31  x32  x33  x34   x35   x36\n";
    for (e=1;e<37;e++)
    {
   	 cout<<"Enter x"<<e<<"Number (First Matrix):\t";
   	 cin>>x[c];
    }
 	 cout<<"x[1]<<setw(4)<<x[2]<<setw(4)<<x[3]<<setw(4)<<x[4]<<setw(4)<<x[5]<<setw(4)<<x[6]\n"
    <<"x[7]<<setw(4)<<x[8]<<setw(4)<<x[9]<<setw(4)<<x[10]<<setw(4)<<x[11]<<setw(4)<<x[12]\n"
    <<"x[13]<<setw(4)<<x[14]<<setw(4)<<x[15]<<setw(4)<<x[16]<<setw(4)<<x[17]<<setw(4)<<x[18]\n"
    <<"x[19]<<setw(4)<<x[20]<<setw(4)<<x[21]<<setw(4)<<x[22]<<setw(4)<<x[23]<<setw(4)<<x[24]\n"
    <<"x[25]<<setw(4)<<x[26]<<setw(4)<<x[27]<<setw(4)<<x[28]<<setw(4)<<x[29]<<setw(4)<<x[30]\n"
    <<"x[31]<<setw(4)<<x[32]<<setw(4)<<x[33]<<setw(4)<<x[34]<<setw(4)<<x[35]<<setw(4)<<x[36]\n";
 	 cout<<"Number (Second Matrix)\n"
    <<"x37  x38  x39  x40   x41   x42\n"
    <<"x43  x44  x45  x46   x47   x48\n"
    <<"x49  x50  x51  x52   x53   x54\n"
    <<"x55  x56  x57  x58   x59   x60\n"
    <<"x61  x62  x63  x64   x65   x66\n"
    <<"x67  x68  x69  x70   x71   x72\n";
    for (f=37;e<73;e++)
    {
   	 cout<<"Enter x"<<e<<"Number (First Matrix):\t";
   	 cin>>x[c];
    }
 	 cout<<"x[37]<<setw(4)<<x[38]<<setw(4)<<x[39]<<setw(4)<<x[40]<<setw(4)<<x[41]<<setw(4)<<x[42]\n"
    <<"x[43]<<setw(4)<<x[44]<<setw(4)<<x[45]<<setw(4)<<x[46]<<setw(4)<<x[47]<<setw(4)<<x[48]\n"
    <<"x[49]<<setw(4)<<x[50]<<setw(4)<<x[51]<<setw(4)<<x[52]<<setw(4)<<x[53]<<setw(4)<<x[54]\n"
    <<"x[55]<<setw(4)<<x[56]<<setw(4)<<x[57]<<setw(4)<<x[58]<<setw(4)<<x[59]<<setw(4)<<x[60]\n"
    <<"x[61]<<setw(4)<<x[62]<<setw(4)<<x[63]<<setw(4)<<x[64]<<setw(4)<<x[65]<<setw(4)<<x[66]\n"
    <<"x[67]<<setw(4)<<x[68]<<setw(4)<<x[69]<<setw(4)<<x[70]<<setw(4)<<x[71]<<setw(4)<<x[72]\n";
 	 x[74]=(x[1]*x[37])+(x[2]*x[43])+(x[3]*x[49])+(x[4]*x[55])+(x[5]*x[61])+(x[6]*x[67]);
            x[75]=(x[1]*x[38])+(x[2]*x[44])+(x[3]*x[50])+(x[4]*x[56])+(x[5]*x[62])+(x[6]*x[68]);
            x[76]=(x[1]*x[39])+(x[2]*x[45])+(x[3]*x[51])+(x[4]*x[57])+(x[5]*x[63])+(x[6]*x[69]);
            x[77]=(x[1]*x[40])+(x[2]*x[46])+(x[3]*x[52])+(x[4]*x[58])+(x[5]*x[64])+(x[6]*x[70]);
            x[78]=(x[1]*x[41])+(x[2]*x[44])+(x[3]*x[53])+(x[4]*x[59])+(x[5]*x[65])+(x[6]*x[71]);
            x[79]=(x[1]*x[42])+(x[2]*x[45])+(x[3]*x[54])+(x[4]*x[60])+(x[5]*x[66])+(x[6]*x[72]);
            x[80]=(x[7]*x[37])+(x[8]*x[43])+(x[9]*x[49])+(x[10]*x[55])+(x[11]*x[61])+(x[12]*x[67]);
            x[81]=(x[7]*x[38])+(x[8]*x[44])+(x[9]*x[50])+(x[10]*x[56])+(x[11]*x[62])+(x[12]*x[68]);
            x[82]=(x[7]*x[39])+(x[8]*x[45])+(x[9]*x[51])+(x[10]*x[57])+(x[11]*x[63])+(x[12]*x[69]);
            x[83]=(x[7]*x[40])+(x[8]*x[46])+(x[9]*x[52])+(x[10]*x[58])+(x[11]*x[64])+(x[12]*x[70]);
            x[84]=(x[7]*x[41])+(x[8]*x[47])+(x[9]*x[53])+(x[10]*x[59])+(x[11]*x[65])+(x[12]*x[71]);
            x[85]=(x[7]*x[42])+(x[8]*x[48])+(x[9]*x[54])+(x[10]*x[60])+(x[11]*x[66])+(x[12]*x[72]);
            x[86]=(x[13]*x[37])+(x[14]*x[43])+(x[15]*x[49])+(x[16]*x[55])+(x[17]*x[61])+(x[18]*x[67]);
            x[87]=(x[13]*x[38])+(x[14]*x[44])+(x[15]*x[50])+(x[16]*x[56])+(x[17]*x[62])+(x[18]*x[68]);
            x[88]=(x[13]*x[39])+(x[14]*x[45])+(x[15]*x[51])+(x[16]*x[57])+(x[17]*x[63])+(x[18]*x[69]);
            x[89]=(x[13]*x[40])+(x[14]*x[46])+(x[15]*x[52])+(x[16]*x[58])+(x[17]*x[64])+(x[18]*x[70]);
            x[90]=(x[13]*x[41])+(x[14]*x[47])+(x[15]*x[53])+(x[16]*x[59])+(x[17]*x[65])+(x[18]*x[71]);
            x[91]=(x[13]*x[42])+(x[14]*x[48])+(x[15]*x[54])+(x[16]*x[60])+(x[17]*x[66])+(x[18]*x[72]);
            x[92]=(x[19]*x[37])+(x[20]*x[43])+(x[21]*x[49])+(x[22]*x[55])+(x[23]*x[61])+(x[24]*x[67]);
            x[93]=(x[19]*x[38])+(x[20]*x[44])+(x[21]*x[50])+(x[22]*x[56])+(x[23]*x[62])+(x[24]*x[68]);
            x[94]=(x[19]*x[39])+(x[20]*x[45])+(x[21]*x[51])+(x[22]*x[57])+(x[23]*x[63])+(x[24]*x[69]);
            x[95]=(x[19]*x[40])+(x[20]*x[46])+(x[21]*x[52])+(x[22]*x[58])+(x[23]*x[64])+(x[24]*x[70]);
            x[96]=(x[19]*x[41])+(x[20]*x[47])+(x[21]*x[53])+(x[22]*x[59])+(x[23]*x[65])+(x[24]*x[71]);
            x[97]=(x[19]*x[42])+(x[20]*x[48])+(x[21]*x[54])+(x[22]*x[60])+(x[23]*x[66])+(x[24]*x[72]);
            x[98]=(x[25]*x[37])+(x[26]*x[43])+(x[27]*x[49])+(x[28]*x[55])+(x[29]*x[61])+(x[30]*x[67]);
            x[99]=(x[25]*x[38])+(x[26]*x[44])+(x[27]*x[50])+(x[28]*x[56])+(x[29]*x[62])+(x[30]*x[68]);
 	 x[100]=(x[25]*x[39])+(x[26]*x[45])+(x[27]*x[51])+(x[28]*x[57])+(x[29]*x[63])+(x[30]*x[69]);
            x[101]=(x[25]*x[40])+(x[26]*x[46])+(x[27]*x[52])+(x[28]*x[58])+(x[29]*x[64])+(x[30]*x[70]);
 	 x[102]=(x[25]*x[41])+(x[26]*x[47])+(x[27]*x[53])+(x[28]*x[59])+(x[29]*x[65])+(x[30]*x[71]);
 	 x[103]=(x[25]*x[42])+(x[26]*x[48])+(x[27]*x[54])+(x[28]*x[60])+(x[29]*x[66])+(x[30]*x[72]);
            x[104]=(x[31]*x[37])+(x[32]*x[43])+(x[33]*x[49])+(x[34]*x[55])+(x[29]*x[61])+(x[30]*x[67]);
            x[105]=(x[31]*x[38])+(x[32]*x[44])+(x[33]*x[50])+(x[34]*x[55])+(x[29]*x[61])+(x[30]*x[67]);
            x[106]=(x[31]*x[39])+(x[32]*x[45])+(x[33]*x[51])+(x[34]*x[55])+(x[29]*x[61])+(x[30]*x[67]);
            x[107]=(x[31]*x[40])+(x[32]*x[46])+(x[33]*x[52])+(x[34]*x[55])+(x[29]*x[61])+(x[30]*x[67]);
            x[108]=(x[31]*x[41])+(x[32]*x[47])+(x[33]*x[53])+(x[34]*x[55])+(x[29]*x[61])+(x[30]*x[67]);
            x[109]=(x[31]*x[42])+(x[32]*x[48])+(x[33]*x[54])+(x[34]*x[55])+(x[29]*x[61])+(x[30]*x[67]);
 	 
 	 cout<<"Matrix 1 * Matrix 2 = \n";
 	 cout<<x[74]<<setw(4)<<x[75]<<setw(4)<<x[76]<<setw(4)<<x[77]<<setw(4)<<x[78]<<setw(4)<<x[79]<<endl
                <<x[80]<<setw(4)<<x[81]<<setw(4)<<x[82]<<setw(4)<<x[83]<<setw(4)<<x[84]<<setw(4)<<x[85]<<endl
                <<x[86]<<setw(4)<<x[87]<<setw(4)<<x[88]<<setw(4)<<x[89]<<setw(4)<<x[90]<<setw(4)<<x[91]<<endl
                <<x[92]<<setw(4)<<x[93]<<setw(4)<<x[94]<<setw(4)<<x[95]<<setw(4)<<x[96]<<setw(4)<<x[97]<<endl
                <<x[98]<<setw(4)<<x[99]<<setw(4)<<x[100]<<setw(4)<<x[101]<<setw(4)<<x[102]<<setw(4)<<x[103]<<endl
                <<x[104]<<setw(4)<<x[105]<<setw(4)<<x[106]<<setw(4)<<x[107]<<setw(4)<<x[108]<<setw(4)<<x[109]<<endl;
  default:
 	 cout<<"Error Please Try Again"<<endl;
  }
  cout<<"Enter Your Matrix Rank"<<endl
         <<"1.(2*2) Matrix\n"
          <<"2.(4*4) Matrix\n"
          <<"3.(6*6) Matrix\n"
 	 <<"3.Exit\n";
 	 cin>>MatrixRank;
	}
	cout<<"We Hope That You Have Been Intersted With Our Software Matrix Multiplaication For Any Support Please Email Us At Captain_kimo@hotmail.com"<<endl;
	return 0;
	}

يارب يكون كويس ومستني الملاحظات عليه

كيمو

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

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