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

الرجاء الرد سريعا

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

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

الرجاء المساعده في معرف الخطأ الموجود في هذا البرنامج

الذي هو عباره عن اله حاسبه

وشكرا

ابو رواد - فلسطين

#include <iostream.h>
#include <math.h>
#include <stdlib.h>
#include <iomanip.h>

int menu();
int adition(int,int);
int mod1(int,int);
int mult(int,int);
float divs(int,int);
int sub(int,int);
int  sgrt1(int );
int fact(int);
double cosine(double);
double sine(double);
double tanget(double);
double  loge(double );
//double  ln_loge(double );
int abselute(int);
double  exponential(double );
//int succ1(int );
//double  logbase(double );



int main(void)
{
	int x,y,choice , selection;
	double sum;
	cout<<"enter the value of x:";
	cin>>x;
	cout<<"enter the value of y:";
	cin>>y;
	do
	{
  selection = menu();

  switch (selection)
	{
	case 1:sum=adition(x,y);
  cout<<"the sumation of two number is:"<<sum<<endl;
  break;
	case 2:sum=mult(x,y);
  cout<<"the multaplication of two number is:"<<sum<<endl;
  break;
	case 3:sum=float(divs(x,y));
  cout<<"divisable number one by number two is:"<<sum<<endl;
  break;
	case 4:sum=sub(x,y);
  cout<<"the subtract of two number is:"<<sum<<endl;
  break;
	case 5:sum=mod1(x,y);
  cout<<"by using mod for two number the result:"<<sum<<endl;
  break;
	case 6:sum=cosine(x);
  cout<<"the cosine of angle is:"<<sum<<endl;
  break;
	case 7:sum=sine(x);
  cout<<"the sine of angle is:"<<sum<<endl;
  break;
	case 8:sum=tanget(x);
  cout<<"the tanget of angle is:"<<sum<<endl;
  break;
	case 9: sum=log(x);
  cout<<"the natural algpritms for number is:"<<sum<<endl;
  break;
	case 10:sum=fact(x);
  cout<<"the factoria of number is:"<<sum<<endl;
  break;
	case 11:sum=sgrt1(x);
  cout<<"the sgrt for number is:"<<sum<<endl;
  break;
	//default:cout<<"finish \n";
	}
	}
	while (selection !=3);
	return 0;
}



int menu ()

{
	int choice;
	cout<<"THIS PROGRAM TO DONE OPERATION CALCOLATER \n";
	cout<<"-----------------------------------------\n";
	cout<<"1_addition to number :\n";
	cout<<"2_subtract to number :\n";
	cout<<"3_multaple to number :\n";
	cout<<"4_div to number :\n";
	cout<<"5_mod to number:\n";
	cout<<"6_convert to radian:\n";
	cout<<"7_convert to degree:\n";
	cout<<"enter your choice:";
	cin>>choice;
	while (choice >=1)
	{
  cout<<"invalide selection .enter 1,2,3,4,5,6,7:";
  
	}
	return choice;
}




  int addition(int x,int y)
  {
 	 int sum=0;
 	 sum=x+y;
  
  return sum;
  }



  int sub(int x,int y)
  {
 	 int sum=0;
 	 sum=x-y;
  
  return sum;
  }



  int mult (int x,int y)
  {
 	 int sum=0;
 	 sum=x*y;
 	 return sum;
  }



  float divs(int x,int y)
 	 {
    float sum=0;
    sum=float(x/y);
    return sum;
 	 }




  int mod1(int x,int y)
  {
 	 int sum=0;
 	 sum=x%y;
 	 return sum;
  }



  double  cosine(double x)
  {
 	 double sum=0;
 	 sum=cos(x);
 	 return sum;
  }



  double  sine(double x)
  {
 	 double sum=0;
 	 sum=sine(x);
 	 return sum;
  }



  double  tanget(double x)
  {
 	 double sum=0;
 	 sum=tan(x);
 	 return sum;
  }




  double  loge(double x)
  {
 	 double sum=0;
 	 sum=log(x);
 	 return sum;
  }



	/*	double  ln_loge(double x)
  {
 	 double sum=0;
 	 sum=ln(x);
 	 return sum;
  }*/
  double  logbase(double x);
  {
 	 double sum=0;
 	 sum=log10(x);
 	 return sum;
  }/*
  int succ1(int x)
  {
 	 int sum=0;
 	 sum=succ(x);
 	 return sum;
  }

  */
  int fact(int x)
  {
 	 int sum=1;
 	 for(int i=1;i<=x;i++)
    sum=sum*i;
 	 return sum;
  }



  int  sgrt1(int x)
  {
 	 int sum=0;
 	 sum=sqrt(x);
 	 return sum;
  }



  int abselute(int x)
  {
 	 int sum=0;
 	 sum=abs(x);
 	 return sum;
  }



  double  exponential(double x)
  {
 	 double sum=0;
 	 sum=exp(x);
 	 return sum;
  }

الرجاء الرد سريعا

تم تعديل هذه المشاركة بواسطة HGB في 24 يوليو 2005 في 23:22

#2

ازل الفارزة المنقوطة:

double logbase(double x);
{
double sum=0;
sum=log10(x);
return sum;
}

الشغلة الثانية, sqrt و log هم Overloaded .. لازم تعمل cast

sum=sqrt((float)x);

case 9: sum=log((float)x);

عندك

int adition(int,int);

مصرح به لكنه غير معرف. (غير موجود)

#3

عندك

CODE

int adition(int,int);

مصرح به لكنه غير معرف. (غير موجود)

شكرا على هذا الرد ...... ولكن ماهو الصحيح اذا في هذا الخطأ .. أفيدونا ... وشكرا

ولكم منا جزيل الشكر...

ابو رواد

#4

يعني أكتب كود لتنفيذ الدالة , مثلا :

int additon(int x,int y)
{
return x+y;
}

أو أي تنفيذ بين القوسين { } في الدالة ,

banner_60_468.gif

NOTHING IS IMPOSSIBLE

#5
int addition(int x,int y)
 {
  int sum=0;
  sum=x+y;

 return sum;
 }

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

وشكرا

#6

الرجاء الرد سريعا يا HGB

وشكرا،،،، ،،،، ،،،،

#7

حلك صحيح ياأخى وايضا طريقة الاستاذ هيثم صحيحة وتدل على الاحتراف والتقصير فى الكود

Muhammad Allam

Computer Science

@Resource(MappedURL="My Blog" )

#8

أخي الكريم قرأت الكود وعندي ملاحظة هذه الداله ىلم تكمل فكيف يعرف المستخدم بهذه الخيارات 8 9 10

int menu ()

{
int choice;
cout<<"THIS PROGRAM TO DONE OPERATION CALCOLATER \n";
cout<<"-----------------------------------------\n";
cout<<"1_addition to number :\n";
cout<<"2_subtract to number :\n";
cout<<"3_multaple to number :\n";
cout<<"4_div to number :\n";
cout<<"5_mod to number:\n";
cout<<"6_convert to radian:\n";
cout<<"7_convert to degree:\n";
cout<<"enter your choice:";
cin>>choice;
while (choice >=1)
{
 cout<<"invalide selection .enter 1,2,3,4,5,6,7:";

}
return choice;
}

وشكرا

abofahad5515@hotmail.com

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

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