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

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

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

اخي captain_kimo

جهد تحسد عليه

لكن حسب رايي المتواضع ارى انه يجب استخدام for loop هنا :(

وهيي كثيرا ستسهل العمليه وتجعلها اسرع :lol:

والله اعلم

ننتظر منك المزيد من الاكواد

52gv0m.gif
#52

مثل ماقال اخي نوري.. الكود طويل زيادة عن اللزوم.. لو استخدمت for loop

وقسمت بعض اجزاء برنامجك لدوال.. كان افضل.. واسهل للتطوير والصيانة فيما بعد...

ولكن مع ذلك فكرة الكود جيدة وعمل شي ذاتي .. انجاز.

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

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

CodingAlone.com

twitter @abshammeri

abshammeri AT gmail.com

github : abshammeri

#53

جهودكم رائعه يا شباب ..

يعطيكوا العافيه ..

:)

المزيد من الكودات .. قريباً إن شاء الله

12.gif

cs.jpg

#54

هذا الكود من احد المنتديات العالميه ..

الكود رائع .. برنامج شامل لحساب بعض الاقترانات الرياضيه ..

// Special Numeric Function Program
// Implements different numeric functions, including:
//    factorial, perfect number, fibonacci sequence
//    gcf and lcm, and permutation and combinations


#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
#include <assert.h>

// Function Prototypes

// FindGCF - returns gcf of num1 and num2
int FindGCF(int num1, int num2);

// FindLCM - returns lcm of num1 and num2
int FindLCM(int num1, int num2);

// Displays a Fibonacci Sequence up to term num
void ShowFiboSeq(int num);

// fact - returns the factorial of num
long double fact(int num);

// permutation - returns nPr
long permutation(int n, int r);

// combination - returns nCr
long combination(int n, int r);

// perfectNum - adds up the factors of num, and stores them in sum
void perfectNum(int num, int& sum);

// Get2Numbers - displays output message, and then inputs 2 intergers
void Get2Numbers(int& n1, int& n2, char* szString);

// Get1Number - display output and then input 1 integer
void Get1Number(int& n1, char* szString);

// MainMenuFunction - main loop, program branches out from here
void MainMenuFunction();

// TestForPerfectNumbers - Function that test for Perfect Numbers
void TestForPerfectNumbers();

// CalculateAFactorial - Factorial Function
void CalculateAFactorial();

// CalcPermorCombination - permutation and combination function 
void CalcPermorCombination();

// FibonacciSeq - Fibonacci Function
void FibonacciSeq();

// FindGCForLCM - GCF or LCM Function
void FindGCForLCM();

// ShowOptions - Option Function
void ShowOptions();

// SwitchChoice - call appropriate function based on choice
void SwitchChoice(int choice);

// End of Function Proto-types


int main()
{
	MainMenuFunction();

	return 0;
} // End of Main


//========================
//Function Definations


void FindGCForLCM()
// precondition: none
// postcondition: none
{
	int choice = -1;  // user entered choice
	int num1 = 0, num2 = 0;	// num1 and num2, store user's input

	system("cls");
	do
	{
  Get1Number(choice, "\n\nFind (1)GCF or (2)LCM: ");
	} while(choice != 1 && choice != 2);

	Get2Numbers(num1, num2, "Enter 2 numbers greater than 0 seperated by a space: ");
	switch(choice)
	{
	case 1:
  cout << "The GCF of " << num1 << " and " << num2 << " is " << FindGCF(num1, num2) << endl;
  break;
	case 2:
  cout << "The LCM of " << num1 << " and " << num2 << " is " << FindLCM(num1, num2) << endl;
  break;
	} // end switch-case
	cout << "\nPress any key to continue..." << endl;
	getch();
}

void TestForPerfectNumbers()
// precondition: none
// postcondition: none
{
	int number = 0;  // number to test 
	int sum = 0;  // sum of factors
	// clrscr();
	cout << "\n\nTest For Perfect Number!\n";
	Get1Number(number, "Enter a valid integer greater than 0: ");
	perfectNum(number, sum);
	if(sum == number)
	{
  cout << " = " << number;
  cout << "\n" << number << " is a pefect number." << endl;
	}
	else
	{
  cout << " <> " << number;
  cout << "\n" << number << " is not a perfect number." << endl;
	} // end of if-else
	cout << "Press a key to continue..." << endl;
	getch();
} // end of TestForPerfectNumbers

void CalculateAFactorial()// Function tests for Factorial of a inputed number
// precondition: none
// postcondition: none
{
	int number = 0;    // number to find factorial of
	long double factorial = 0;	// factorial of number

	// clrscr();
	cout << "\n\nCalculate a Factorial!" << endl;
	Get1Number(number, "Enter a integer greater than 0: ");
	factorial = fact(number);
	cout << "The factorial of " << number << " is " << factorial << endl;
	cout << "Press a key to continue..." << endl;
	getch();
} // end of CalculateAFactorial

void CalcPermorCombination()
// precondition: none
// postcondition: none
{
	int n = 0, r = 0;  // n and r to find permutation of 
	int choice;    // input to store wheter to do a perm or comb
	long perm = 0; 	 // perm of n and r
	long comb = 0; 	 // comb of n and r
	do 
	{
  // clrscr();
  cout << "\n\nFind a (1)Permutation or (2)Combination: ";
  cin >> choice;
	} while(choice != 1 && choice != 2);
	switch(choice)
	{
	case 1:
  cout << "\nCalculate a a permutation!" << endl;
  Get2Numbers(n, r, "Enter n then r seperated by a space: ");
  perm = permutation(n, r);
  cout << n << " P " << r << " is " << perm << endl;
  break;
	case 2:
  cout << "\nCalculate a combination!" << endl;
  Get2Numbers(n, r, "Enter n then r seperated by a space: ");
  comb = combination(n, r);
  cout << n << " C " << r << " is " << comb << endl;
  break;
	} //end switch-case
	cout << "\nPress a key to continue..." << endl;
	getch();
} // end of CalcPermorCombination



void FibonacciSeq()
// precondition: none
// postcondition: none
{
	int limit = 0;  // upper limit to generete fibonacci sequence up to
	// clrscr();
	cout << "\n\nGenerate a Fibonacci Sequence!" << endl;
	do 
	{
  Get1Number(limit, "Enter an upper limit greater than 3: ");
	} while(limit < 3);
	ShowFiboSeq(limit);
	cout << "\nPress a key to continue..." << endl;
	getch();
} // end of FibonacciSeq

void ShowOptions()
// precondition: none
// postcondition: none
{
	cout << "\n\n\n\n Special Numberic Function \n";
	cout << "\n================================\n";
	cout << "(1) Test for Perfect Numbers\n";
	cout << "(2) Calculate a Factorial \n";
	cout << "(3) Calculate a Permutation or Combination \n";
	cout << "(4) Generate a Fibonacci Sequence\n";
	cout << "(5) Find a GCF or LCM \n";
	cout << "(6) Exit the Program\n";
	cout << "\n\nEnter your choice: ";
} // end of ShowOptions

void SwitchChoice(int choice)
// precondition: choice must contain have a valid integer value
// postcondition: none
{
	switch(choice)
	{
	case 1:
  TestForPerfectNumbers();
  break;
	case 2:
  CalculateAFactorial();
  break;
	case 3:
  CalcPermorCombination();
  break;
	case 4:
  FibonacciSeq();
  break;
	case 5:
  FindGCForLCM();
  break;
	case 6:
  cout << "\n\nProgram exiting...";
  exit(1);
	} // end switch-case
} // end of SwitchChoice

void MainMenuFunction()
// precondition: none
// postcondition: none
{
	int choice = -1;	// users choice inputed
	while(true)
	{
  // clrscr();
  ShowOptions();
  cin >> choice;
  if(choice)
 	 assert(choice);
  SwitchChoice(choice);
	} // end while
} // end of MainMenuFunction

void Get1Number(int& n1, char* szString)
// precondition: szString must be a valid array of characters
// postcondition: n1 will contain a positive integer value
{
	do 
	{
  cout << szString;
  cin >> n1;
  assert(n1);
	} while(n1 < 1);
} // end of Get1Number

void Get2Numbers(int& n1, int& n2, char* szString)
// precondition: szString must be a valid array of characters
// postcondition: n1 and n2 will contain positive integer values
{
	do 
	{
  cout << szString;
  cin >> n1 >> n2;
  assert(n1); 
  assert(n2);
	} while(n1 < 1 || n2 < 1);
} // end of Get2Numbers

void perfectNum(int num, int& sum)
// precondition: num must have a valid integer value
// postcondtion: sum will contain the sum of num's factors
{
	int temp = num-1;  // temporary number, so num will not change	
	while(temp)
	{
   	 if(num % temp  == 0)
  {
        if(temp != 1)
         	 cout << temp << " + ";
 	 else
         	 cout << temp;
 	 // end if-else
 	 sum += temp;
  } // end if
  temp--;
	} // end while
} // end of perfectNum

int FindGCF(int num1, int num2)
// precondition: num1 and num2 must be valid integer values
// postcondition: returns the gcf of num1 and num2
{
	int fact = num2;
	while(true) 
	{
  while(num2 % fact)
 	 fact--;
  if(num1 % fact == 0)
 	 break;
  fact--;
	}
	return fact;
} // end of FindGCF

int FindLCM(int num1, int num2)
// precondition: num1 and num2 must be valid integer values
// postcondition: returns the lcm of num1 and num2
{
	int lcm = (num1 * num2) / FindGCF(num1, num2);  // lcm of num1 and num2, found using formula
              // lcm = ab/gcf(a,b)
	return lcm;
} // end of FindLCM



void ShowFiboSeq(int num)
// precondition: num must be a valid integer value
// postcondition: none
{
	int a=1, b=1, c;  // a, b, c - store values of terms in Fibonacci sequence
	cout << a << " " << b << " ";
	num-=2;
	while(num--)
	{
   	 c=a+b;
  cout << c << " ";
  a=b;
  b=c;
	} // end while
} // end of ShowFiboSeq


long double fact(int num)
// precondition: num must be a valid integer value
// postcondition: returns factorial of num
{
	long fact = 1;  // factorial of number
	if(num < 0) 
  return 0;
	while(num)
  fact *= num--;
	return fact;
} // end of fact

long permutation(int n, int r)
// precondtion: n and r must be valid integer values
// postcondition: n and r will not change, returns nPr
{
	long perm = 1, n2 = n;  // perm is permutation of n and r, n2 stores original value of n
	if(n < r) 
  return 0;
	while(n >= (n2-r+1))
  perm *= n--;
	return perm;
} // end of permutation


long combination(int n, int r)
// precondition: n and r must be valid integer values
// postcondition: n and r will not change, function returns nCr
{
	long comb = permutation(n, r) / fact(r);  // comb - combination of n and r, nCr	
	return comb;
} // end of combination

12.gif

cs.jpg

#55

برنامج الكلندر لكن باستخدام file processing

لكن تحتاج الى فايل اسمه DUMMY2 :lol: :lol:

#include <iostream.h>
#include <fstream.h>
void month1 ( void );
void week1 ( void );
void day1 ( int y);
int loop1 ( int x );
int daystart , year;
ofstream ofile ("DUMMY2.txt");

 int s[12]={31,28,31,30,31,30,31,31,30,31,30,31};
void main()
{
  // input 
	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;
	ofile << " ***************************************************** "<< endl;
	ofile<< "                    THE CALENDAR "<<year<<endl;
    month1 ();
	ofile << " ***************************************************** " << endl;	
}
void week1 ( void )
{
	ofile << "\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++)
  {

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

شكرا لك اخي نوري على الرد ولكن اخي ان حاولت اعملها لوب بس ساعات مش بفضل عملها في الحالات دي وبالمناسبة المفروض البرنامج دا كان معمول في في مسابقة سي بلاس بلاس في الكلية والمفروض اننا كنا نوصل لغاية 32*32 فلك ان تتخيل اني انجزت هذا البرنامج بالصورة الحاليه في عشر ساعات تقريبا :) فما بالك ببقية البرنامج , عموما اخي لو بالامكان انك تعملها لوب مع الحفاظ على ان رتبة المصفوفه تزيد اتنين وان حاصل الضرب يكون كما في قوانين المصفوفات اكون شاكر جدا

كيمو

#57
captain_kimo كتب:
شكرا لك اخي نوري على الرد ولكن اخي ان حاولت اعملها لوب بس ساعات مش بفضل عملها في الحالات دي وبالمناسبة المفروض البرنامج دا كان معمول في  في مسابقة سي بلاس بلاس في الكلية والمفروض اننا كنا نوصل لغاية 32*32 فلك ان تتخيل اني انجزت هذا البرنامج بالصورة الحاليه في عشر ساعات تقريبا :) فما بالك ببقية البرنامج , عموما اخي لو بالامكان انك تعملها لوب مع الحفاظ على ان رتبة المصفوفه تزيد اتنين وان حاصل الضرب يكون كما في قوانين المصفوفات اكون شاكر جدا

كيمو

اخي كيمو

يعطيك الف عااافية على هالجهد الرائع :rolleyes: :rolleyes:

وحاحاول اعمله بالفور لوب :( :( :(

وتحياتي

52gv0m.gif
#58

جمع مصفوفتين

#include <iostream.h> 
main() 
{ 
float a[2][3], b[2][3]; 
int i, j; 
cout << "\n \a Please enter the elements: "; 
for(i=0; i<2; i++) 
for(j=0; j<3; j++) 
{ 
cout << "\n A[ "<< i+1<< " , "<< j+1 << " ] = "; 
cin >> a[j]; 
cout << "\t B[ "<< i+1<< " , "<< j+1 << " ] = "; 
cin >> b[j]; 
} 
for(i=0; i<2; i++) 
{ 
for(j=0; j<3; j++) 
cout << a[j]+b[j] << "\t"; 
cout << '\n'; 
} 
}
52gv0m.gif
#59

برنامج لحل المعادلات من مجهول واحد فقط

#include <iostream.h>
#include <windows.h>
main ()
{
	float a,b,c;
  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_H
ANDLE), FOREGROUND_RED|FOREGROUND_INTENSITY);
	cout<<"Bienvenue A Mon Premier Programme !"<<endl<<endl;
	cout<<"Soit ax+b=0 Une Equation Et S l'Ensemble Des Solutions ."<<endl;
	cout<<endl<<"Enter a : ";
	cin>>a;
	cout<<"Enter b : ";
	cin>>b;
	if (a!=0)
	cout <<a<<"x+"<<b<<"=0"<<endl;
	cout <<a<<"x="<<-b<<endl	<<"x="<<-b<<"/"<<a<<endl;
	cout <<"x="<<-b/a<<endl<<endl;
	cout <<"S={"<<-b/a<<"}"<<endl;
	cout <<"Or"<<endl<<"S={"<<-b<<"/"<<a<<"}"<<endl;
	if (a==0 && b==0)
  cout<<endl<<"Quelque soit Le Nombre x On A : 0*x+0=0"<<endl<<endl<<"S=IR"<<endl;
	if (a==0 && b!=0)
  cout<<endl<<"Il N'Y A Aucun Nombre x Tel Que 0*x="<<-b<<endl<<"S={ }"<<endl;
	cout<<endl;
	return 0;
}
52gv0m.gif
#60

برنامج التقويم ادخل اي سنه منذ سنه 101 الى اي سنه وبيجيب التقويم :lol:

ارهقتني حسابات التواريخ

واي ملاحظه على البرنامج جاهز اعدلها :lol: :lol: :lol:

الكود

#include <iostream.h>
#include<process.h>
#include <windows.h>
#include <fstream.h>
void month1 ( void );
void week1 ( void );
void day1 ( int y);
int loop1 ( int x );
int year1(void);
ofstream ofile ( "DUMMY2.txt");
int daystart , year ,dayend,j,day=0;
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 MoRe ThAn 100 :>>  ";
 cin  >> year;
 cout << endl<< endl;
 if ( year<101 )
 {
 exit (1);
 }
  int a=0,b,z,zz;
  for(  j=101;j<=year;j++)
   {
	daystart++;
  } 
   day =daystart;
  if( day>4)
  {
   for (int i=5;i<=day;i+=4)
   {
	a++;
   }
   daystart=day+a;
  }
     if ( daystart>7)
   {
	if ( daystart%7==1){daystart=1;}else
	if ( daystart%7==2){daystart=2;}else
	if (daystart%7==3){daystart=3;}else
	if (daystart%7==4){daystart=4;}else
	if (daystart%7==5){daystart=5;}else
	if (daystart%7==6){daystart=6;}else
	{daystart=7;}
   }   
    cout <<"daystart=";
	cout << daystart<<endl;
   
  
   ofile << " ***************************************************** "<< endl;
   ofile << "            THE CALENDAR YEAR "<<year<< " is :"<<endl;
   month1 ();
   ofile << " ***************************************************** " << endl; 
} 

void week1 ( void )
{
 ofile  << "\tsat    sun     mon     tues    wed	thur	fri     "<< endl;
} 
int loop1( int x)
{
   if (year==0)
 {	
	return 0;
   }
   else
   {
  if (year%100!=0 && year%4==0)
   {        
   return 1;
   }
  else 
   if (year%400==0)
   {
  return 1;
   } 
   else
	{
  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++)
  {

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

بتمنا يكون البرنامج نال رضاكم :angry: :angry:

52gv0m.gif
#61

بارك الله في مجهوداتكم انا بس اخلص من الامتحانات واشوف ايه الي ممكن نقدمه في الموضوع دا

#62

اليوزر يدخل 123 البرنامج يخرج 321

سهله :lol: :lol:

من اضافه الاخ Great :rolleyes:

الكود

#include <iostream.h>
#include <string.h>
void main()
{
char a[30];
int i;
cout<<"a=";cin>>a;
for (i=strlen(a);i>-1;--i)
{
 cout<<a;
}
cout<<endl;
}
52gv0m.gif
#63

ال user رقم وانا اجيب حاصب جمع (مربع الرقم +مربع الارقام التي تسبقة)

فهمتو شي ؟؟ :( :(

ولا انا :lol: :lol:

الكود ايضا من اضافه الاخ Great

#include <iostream.h>
void main()
{
int a,s=0;
cout<<"a=";cin>>a;
for (int i=1;i<=a;++i)
{
 s=s+(i*i);
}
cout<<"s="<<s<<endl;
}
52gv0m.gif
#64
captain_kimo كتب:
بارك الله في مجهوداتكم انا بس اخلص من الامتحانات واشوف ايه الي ممكن نقدمه في الموضوع دا

اخي نحن في انتظارك

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

52gv0m.gif
#65

برنامج سهل جدا :lol:

يدخل اليوزر عدد من الارقام .. البرنامج يخرج اكبر رقم .. وثاني اكبر رقم

مثال : 2 ,5,29,33

البرنامج : 33,29

#include "iostream.h"

int main()
{
// always make your programs as simple as possible 
int n,tmp,j,largarray[512];
cout << "how many numbers do you want to enter ? \n";
cin >> n; //do a check on "n" musnt be larger than largarray[]
for(int i =0;i<n;i++)
{
 int x=i+1;
 cout << "enter "<<x<<" number :\n";
 cin >> largarray;
}
for (i=0; i<n-1; i++) 
{
 for (j=0; j<n-1-i; j++)
    if (largarray[j] < largarray[j+1]) //<- switch [j] with [j+1]
 {           // to get the oppesite  
  tmp = largarray[j];
  largarray[j] = largarray[j+1];
  largarray[j+1] = tmp;
 }
}
cout <<"the largest number is "<<largarray[0]<<endl //  ^
<<"the 2nd largest is "<<largarray[1]<<endl;  //  |
/* the first element contains the biggest number   |
   the last element is the smallest, also it depends on  |
   so it will be the oppesite if you switch j with j+1 */
return 0;
}
52gv0m.gif
#66

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int x;

cout<<"please enter the number\n";

if(x%2==o)

cout<<"even";

else

cout<<"odd";

getch();

}

[code/]

تم تعديل هذه المشاركة بواسطة عصام اليماني في 7 مايو 2005 في 12:17

#67

لعبه x ,o الشهيره :lol: :lol: تعبت فيها

#include <iostream.h>
void  matrix (void);
bool check (void);
bool checkplace (int i,int j);
char a[3][3];
void main ()
{
	int i,j;
	for (i=0;i<3;i++)
	for (j=0;j<3;j++)
  a[j]='s';
	do
	{
err:
  cout << "player1: enter now of row : ";
  cin>>i;
  cout <<" player1:enter now of col..: ";
  cin>>j;
  if ( checkplace (i,j)==true)
 	 a[j]='x';
  else
  {
 	 cout <<" invalid location "<<endl;
 	 goto err;
  }
  matrix();
  if (check()==true)
 	 return;
er:
  cout <<"player2:enter no of row :";
  cin>>i;
  cout <<"player2:enter the no of clo..: ";
  cin>>j;
  if (checkplace (i,j)==true)
 	 a[j]='o';
  else 
  {
 	 cout <<" invalid location"<<endl;
 	 goto er;
  }
  matrix();
  if (check()==true)
 	 return;
	}
	while(i<3);
}
void matrix (void)
{
	for (int i=0;i<3;i++)
	{
  for (int j=0;j<3;j++)
 	 cout<<a[j]<<"  ";
  cout<<endl;
	}
}
bool check(void)
{

	if (a[0][0]==a[0][1]&&a[0][1]==a[0][2]&&a[0][2]!='s')
	{ cout <<" The win is"<<a[0][1]<<endl;return true;} 

    if (a[1][0]==a[1][1]&&a[1][1]==a[1][2]&&a[0][2]!='s')
	{cout <<"the win is "<<a[1][0]<<endl;return true; } 

	if (a[2][0]==a[2][1]&&a[2][1]==a[2][2]&&a[2][2]!='s')
	{cout <<"the win is "<<a[2][0]<<endl;return true;}
  
	if (a[0][0]==a[1][0]&&a[1][0]==a[2][2]&&a[2][2]!='s')
	{cout <<"the win is  "<<a[0][0]<<endl;return true;}

	if (a[0][1]==a[1][1]&&a[1][1]==a[2][1]&&a[2][1]!='s')
	{cout <<"the win is  "<<a[0][1]<<endl;return true;}

	if (a[0][2]==a[1][2]&&a[1][2]==a[2][2]&&a[2][2]!='s')
	{cout <<"the win is  "<<a[0][1]<<endl;return true;}

	if (a[0][0]==a[1][1]&&a[1][1]==a[2][2]&&a[2][2]!='s')
	{cout <<"the win is "<<a[0][0]<<endl;return true;}

	if (a[0][2]==a[1][1]&&a[1][1]==a[2][0]&&a[2][0]!='s')
	{cout <<"the win is "<<a[0][2]<<endl;return true;}
	return false;
}
bool checkplace (int i,int j)
{
	for (int b=0;b<3;b++)
	{
  for (int c=0;c<3;c++)
  {
 	 if ((a[j]==a[c])&&(a[j]!='s'))
 	 {
    return false;
 	 }
  }
	}
	return true;
}

52gv0m.gif
#68

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

الاخوة في المنتدى لكم منا الف تحية وتقدير , وبعــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــد

ارجو منكم ومن الاخ نوري ان يعطينا برنامج لحساب المضروب بس ياليت ب....while<<<<<وايضابـــــــــ<<do while

وايضا بـــــــــــــــ,,,,,,,,for

وتقبلو خالص تحياتنا

ثانيا ارجو منكم ان تعطونا برنامج مثلا يعد من العدد واحد الى عشرة او الى اي عدد ,, ياليت تنفذو طلبنا

عصام عبد الله

اليمن

#69

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

الاخوة في المنتدى ارجو منكم ان تقدمو ا لنا مساعدة ارجو من الاخوة والاخ نوري برنامج لحساب المضروب بس با لدوال

while والدالة do while والدالة for

وارجو منكم برنامج يعد من العدد واحد الى العد مثلا عشرة ,ولكم منا الف تحية

اخوكم عصام عبد الله

اليمن

#70
نوري_86 كتب:
برنامج سهل جدا  :lol:

يدخل اليوزر عدد من الارقام .. البرنامج يخرج اكبر رقم .. وثاني اكبر رقم

مثال : 2 ,5,29,33

البرنامج : 33,29

اذا أدخلت مثلا 4 أرقام

77

54

77

12

ستكون النتيجة

أكبر رقم هو 77

ثاني أكبر رقم هو 77

:lol:

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

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