Hey I have problem here ^_^
If I have
int a = 10;
int b = 2;
int c = (a&b) << 1
the result of c is 4 but I don't know the process
what does (a&b) means?
what does <<1 means?
--------------------------------------------
int a = 5;
int b = 9;
int c = 7;
int d;
d= a>b? a>c? a : c: b>c? b:c
//d=9 it is the max number of a,b,c
//What does "d= a>b? a>c? a : c: b>c? b:c" means? I still confused
--------------------------------------------
int a = 11;
float b,c,d;
b = a/2;
c = a/2.;
d = a/b;
printf("b = %f\n",b);
printf("c = %f\n",c);
printf("d = %f\n",d);
//the result is
//b = 5.000000
//c = 5.500000
//d = 2.200000
//I still confused how to divide int by float....
-----------------------------------------------------
int i =5,x;
switch(i)
{
default:
x=100;
case 1:
x=10;break;
case 2:
x=20;break;
case 3:
x=30;break;
case 4:
x=40;break;
}
printf("%i", x);
//the result is 10, why not 100?
-------------------------------------------------
Can Someone Help me? I will appreciate that! ^^
1_ http://cplusplus.com/doc/tutorial/operators/ bitwise operators.
2_ That's obfuscated. Replace it by if and else
3_ ¿what is that you don't understand?
4_ ¿why did you use break in the other cases?