#include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
int mean(void)
{
int op=0;
printf("/_________________\n");
printf("1-----与操作\n");
printf("2-----\n");
printf("3-----\n");
printf("4-----\n");
printf("5-----\n");
printf("6-----\n");
printf("7-----\n");
printf("8-----\n");
printf("9-----\n");
printf("10-----\n");
printf("100-----\n");
printf("_________________\n");
printf("请输人功能选择:");
scanf("%d",&op);
printf("1-----与操作\n");
printf("2-----\n");
printf("3-----\n");
printf("4-----\n");
printf("5-----\n");
printf("6-----\n");
printf("7-----\n");
printf("8-----\n");
printf("9-----\n");
printf("10-----\n");
printf("100-----\n");
return op;
}
bool Function1(bool a,bool b)
{
return a&b;
}
bool Function2(bool a,bool b)
{
return a||b;
}
bool Function3(bool a)
{
a=!a;
return a;
}
bool Function4(bool a,bool b)
{
return a&b;
}
double Function5(int a)
{
a=abs(a);
return a;
}
int Function6(int a,int b)
{
return a%b;
}
int Function7(int a,int b)
{
return (a+b)/2;
}
int Function8(int n)
{
int sum=0;
for(int i=1; i<=n; i++)
sum+=i;
return sum;
}
int Function9(int n)
{
int sum=1;
for(int i=1; i<=n; i++)
sum*=i;
return sum;
}
int Function10(double n)
{
return n;
}
int main(void)
{
int choice;
bool boola,boolb,boolresult;
int inta,intb,intresult;
double doublea,doubleb,doubleresult;
while(1)
{
int op = mean();
if(100==op)
{
break;
}
switch(op)
{
case 1:{
cin>>boola>>boolb;
doubleresult = Function1(boola,boolb);
break;
}
case 2:{
cin>>boola>>boolb;
doubleresult = Function2(boola,boolb);
break;
}
case 3:
cin>>boolresult;
doubleresult = Function3(boolresult);
break;
case 4:{
cin>>boola>>boolb;
doubleresult = Function4(boola,boolb);
break;
}
case 5:{
cin>>inta;
doubleresult = Function5(inta);
break;
}
case 6:{
cin>>doublea>>doubleb;
doubleresult = Function6(doublea,doubleb);
}
case 7:{
cin>>inta>>intb;
doubleresult = Function7(inta,intb);
break;
}
case 8:{
cin>>inta;
doubleresult = Function8(inta);
break;
}
case 9:{
cin>>inta;
doubleresult = Function9(inta);
break;
}
case 10:{
cin>>doubleresult;
doubleresult =Function10(doubleresult);
break;
}
default:{
cout<<"错误";
}
}
printf("doubleresult =%.3lf\n",doubleresult);
}
return 0;
}