Im doing an assignment
- asr - arithmetic shift right the bits of number1, number2 places to the right (see below)
- rol - rotate the bits of number1, number2 places to the left (see below)
- ror - rotate the bits of number1, number2 places to the right
Im having trouble figuring out how to do this part
here is what i have so far
int main()
{
char n[90];
char method[90];
unsigned int num1;
int methodlength;
unsigned int num2;
int d;
unsigned int answer;
printf("Type in an expression: ");
gets(n);
sscanf(n, "%x %s %x", &num1, method, &num2);
if(strcmp(method, "asr") == 0)
{
printf("The answer is: %x", answer);
}
else if(strcmp(method, "rol") == 0)
{
printf("The answer is: %x", answer);
}
else if(strcmp(method, "ror") == 0)
{
printf("The answer is: %x", answer);
}
}