هـــ(حبايبي)ـــلا
اود منكم مساعدتي في اعداد برنامج ب C++ يحسب كل شى مثل
+ - * % /
شاكرا لكم
هـــ(حبايبي)ـــلا
اود منكم مساعدتي في اعداد برنامج ب C++ يحسب كل شى مثل
+ - * % /
شاكرا لكم
يعني
اريد برنامج يحسب لي الجمع و الطرح و القسمه و الضرب
بالمختصر المفيد برنامج يحسب جميع العمليات الحسابيه
بإستخدام c++
اتمنى وضوح الفكره
شكرا
السلام عليكم.
أخي هذا برنامج بسيط يستخدم العمليات الحسلبية البسيطة :
#include
main
{
float a,b;
printf("Please Enter two numbers : ");
scanf("%f %f" , &a , &b );
printf("a + b = %fn", a+b );
printf("a - b = %fn", a-b );
printf("a * b = %fn", a*b );
printf("a / b = %fn", a/b );
}إذا أردت المزيد من المعلومات فالرجاء التوضيح.
مع التحيات.
اشكرك يا أخي
ولكن هذا البرنامج بC
انا اريده ب C++
السلام عليكم ورحمة الله وبركاته
يسعدني ان اشارك وياكم في هالمنتدى الرائع
perfect gentleman
سؤالك حلو فكتبت البرنامج الي تباه وان شاء الله يكون على قد المطلوب
#include
#include
class operation
{
private:
float n;
public:
operation (){};
operation(float num)
{
n=num;
}
void operator +(operation h)
{
float temp;
temp=n+h.n;
cout<<" "<
// cout<
}
void operator -(operation h)
{
float temp;
temp=n-h.n;
cout<<" "<
}
void operator *(operation h)
{
float temp;
temp=n*h.n;
cout<<" "<
}
void operator /(operation h)
{
float temp;
if(h.n==0)
cout<<" "<<"can't divide by zeron";
else
{
temp=n/h.n;
cout<<" "<
}
}
void setvalue(float x)
{
n=x;
}
};
main()
{
operation a,b,c;
float x;
int i;
while(i!=5)
{
cout<<"****Main Menu****n";
cout<<"1.additionn";
cout<<"2.subtractionn";
cout<<"3.multiplicationn";
cout<<"4.divitionn";
cout<<"5.Endn";
cout<<"enter your choisen";
cin>>i;
switch(i)
{
case 1:
cout<<"Enter the first number:na=";
cin>>x;
a.setvalue(x);
cout<<"enter the second number:nb=";
cin>>x;
b.setvalue(x);
a+b;
cout<<"n";
break;
case 2:
cout<<"Enter the first number:na=";
cin>>x;
a.setvalue(x);
cout<<"enter the second number:nb=";
cin>>x;
b.setvalue(x);
a-b;
cout<<"n";
break;
case 3:
cout<<"Enter the first number:na=";
cin>>x;
a.setvalue(x);
cout<<"enter the second number:nb=";
cin>>x;
b.setvalue(x);
a*b;
cout<<"n";
break;
case 4:
cout<<"Enter the first number:na=";
cin>>x;
a.setvalue(x);
cout<<"enter the second number:nb=";
cin>>x;
b.setvalue(x);
a/b;
cout<<"n";
break;
}
} }
هذا الموضوع مغلق.