91学习

陪伴你每一天!

如果字符串含有宏名则不替换

#include <stdio.h>#define TEST "this is an example"void main(){ char exp[30]="This TEST is not that TEST"; printf("%s\n",exp);}

循环右移操作

#include <stdio.h>right(unsigned value,int n){ unsigned z; z=(value<<(32-n))|(value>>n); return z;}void main(){ unsigned a; int n; printf("please input a number :\n"); scanf("%o",&a); printf("please inpu

实现循环左移

#include <stdio.h>left(unsigned value,int n){ unsigned z; z=(value>>(32-n))|(value<<n); return z;}void main(){ unsigned a; int n; printf("please input a number:\n"); scanf("%o",&a); printf("please input

C语言的右移操作

#include <stdio.h>void main(){ int x=30,y=-30; x=x>>3; y=y>>3; printf("the result1 is:%d,%d\n",x,y); x=x>>2; y=y>>2; printf("the result2 is:%d,%d\n",x,y);}

C语言左移《的运算

#include <stdio.h>void main(){ int x=15; x=x<<2; printf("the result is:%d\n",x); x=x<<3; printf("the result is:%d\n",x);}

C语言的异或运算

#include <stdio.h>int main(){ unsigned result; int a,b; printf("please input a:"); scanf("%d",&a); printf("please input b:"); scanf("%d",&b); printf("a=%d,b=%d",a,b); result=a^b; printf(

C语言的取反操作

#include <stdio.h>int main(){ unsigned result; int a; printf("please input a:"); scanf("%d",&a); printf("a=%d",a); result=~a; printf("\n~a=%o\n",result); return 0;}

C语言中的或运算

#include <stdio.h>int main(){ int a=0XEFCA ,result; result=a|a; printf("a|a=%X\n",result); return 0;}

将两个人的年龄进行与运算

#include <stdio.h>void main(){ unsigned result; int age1,age2; printf("please input age1:"); scanf("%d",&age1); printf("please input age2:"); scanf("%d",&age2); printf("age1=%d,age2=%d",

用枚举enum 输出你喜欢的颜色

#include <stdio.h>enum Color{Red=1,Blue,Green} color;int main(){ int icolor; printf("请输入你喜欢的颜色编号:\n"); scanf("%d",&icolor); switch(icolor){ case Red: printf("the choice is Red\n"); break; case Blue: printf(&