بسم الله الرحمن الرحيم
السلام عليكم ورحمة الله وبركاته
انا قاعد اعمل برنامج يقوم بعدة مهام الجمع والطرح والضرب وال factorial وال swap والخروج من البرنامج
يقوم البرنامج بطلب من المستخدم ادخال اي رقم من واحد الي سته حيث
1-جمع
2-طرح
3-ضرب
4-مضروب عدد factorial
5-swap تبديل بين قيمتين
6- الخروج من البرنامج exit
يعني عندما ندخل رقم 1 سوف يجمع عددين
2 سوف يذهب الي طرح العددين
ولكن توقفت فجأة
الكود يظهر اخطااااا اريد منك التصحيح وماذا ايلزم اضافته
وهذا الكود
# include <iostream.h>
# include <stdio>
int Add (int x, int y)
{return x+y;}
int Sub (int x, int y)
{return x-y;}
int multi (int x, int y)
{return x*y;}
int fact (int x)
for (int i=1;<=x;i++)
{return fact=fact*i;}
int swap (int x, int y) اي ان a=b
x=y;
{return x=y;}
void main()
{
cout<<"Programm Menu\n\n";
cout<<"1- Add tow number\n";
cout<<"2- Sub tow number\n";
cout<<"3- multi tow number\n";
cout<<"4- factorial\n";
cout<<"5- swap\n";
cout<<"6- Exit\n\n";
cout<<"choes number from 1_6\n";
int a,b,result;
cout<<"Enter The First Number\n";
cin>>a;
cout<<"Enter The Second Number\n";
cin>>b;
result=Add(ab);
cout<<"Add result="<<result;
result=Sub (a , b ) ;
cout<<"Sub result="<<result;
result=Multi (a, b ) ;
cout<<"Multi result="<<result;
for (int i=1 ; i<=a; i++)
result=fact*i;
cout<<"Factorial="<<result;
result= (a= b ) ;
cout<<"a="<<a<<"b="<<b;
getchar();}
