예제 #1
0
파일: g7e4.c 프로젝트: pingicx/cx
/*
Chooses the calculation function wanted. Accepts operand 1, operand 2 and a pointer to the operator.
Returns the value calculated by the operating functions.
*/
float calculate(float n1, float n2, int *op) {
	switch (*op) {									// compares to the value of the pointer to the operator. 
	case '+':
		return plus1(n1,n2);
		break;

	case '-':
		return minus1(n1,n2);
		break;

	case '/':
		return divide1(n1,n2);
		break;

	case '*':
		return multiply1(n1,n2);
		break;

	case '^':
		return xor1(n1,n2);
		break;

	case '|':
		return or1(n1,n2);
		break;		

	case '&':
		return and1(n1,n2);
		break;

	default:
		break;
	}
}
예제 #2
0
main()
{
	 int a,b,i,j,sum,max=0;
	 scanf("%d %d",&a,&b);
	


for(i=a;i<=b;i++)
{
	
	for(j=i;j<=b;j++)
	{
		
	
	sum=0;
   sum=xor1(i,j);
   
   if(sum>max)
   max=sum;

}
}

printf("%d",max);

}