c语言中循环右移怎么实现?程序应该怎么写
2个回答
展开全部
unsigned char crol(unsigned char c,unsigned b)
{ //左移
unsigned char left;left=c<<b;
unsigned char right;right=c>>( sizeof (unsigned char )-b) ;
return left|right;
}
unsigned char cror(unsigned char c,unsigned b)
{ //右移
unsigned char right;
right =c>>b;
unsigned char left ;
left=c<<( sizeof (unsigned char )-b) ;
return left|right;
}
{ //左移
unsigned char left;left=c<<b;
unsigned char right;right=c>>( sizeof (unsigned char )-b) ;
return left|right;
}
unsigned char cror(unsigned char c,unsigned b)
{ //右移
unsigned char right;
right =c>>b;
unsigned char left ;
left=c<<( sizeof (unsigned char )-b) ;
return left|right;
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询