拿去交作业吧- -||||| {int temp; }
#include
using namespace std;
int add(int a,int b)
{int c=a+b;
return c;
}
double add(double a,double b)
{double c=a+b;
return c;
}
int divide(int x=345,int y=67)
{int c;
return c=345/67;}
inline int sub(int a,int b)
{int c;
return c=a-b;
}
void exchange(int &x,int &y)
{int temp;
temp=x;x=y;y=temp;
}
void sort()
{
int size,i;
cout<<"请输入数组元素的个数:";
cin>>size;
int *p=new int[size]; //开辟一个存放数组的空间
cout<<"请输入 "<
cin>>p[i];
}
cout<
for(int j=0;j
temp=p[k];p[k]=p[k+1];p[k+1]=temp;
}
cout<<"排序后的结果为:"<
cout<
cout<
}
int main()//主函数
{char g;
int y;int z;
char h;
cout<<".............Welcome to use calculator!.........."<
do{
cout<<"============ Please choose the menu: ============"<
switch(h)
{
case '1':cout<<"请输入相加的两个整数:"<
cin>>d>>f;
c=add( d, f);
cout<<"相加的和为:"<
cin>>i>>j;
k=add( i, j);
cout<<"相加的和为:"<
cin>>m>>n;
l=sub( m,n);
cout<<"相减的差为:"<
cout<<"两个整形数据相除(345/67):"<
x=divide(345,67);
cout<<"结果为:"<
cout<<"输入要交换的两个数"<
cout<
default:cout<<"输入错误,请重新输入!"<
cout<<"是否继续操作:(是请按y---退出请按其它任意键)"<
}
while(g=='y'||g=='Y');
return 0;
}
1
int add(int a,int b){return a+b;}
double add(double a,double b){return a+b;}