点击查看代码
#include <stdio.h>
#define ToString(a)#a "oh~天啦!"
#define VAR(b) num##b
#define ToChar(c) #@c
#ifdef __cplusplus //判断是不是c++文件
//#error 亲,请使用c++文件哦!
#endif // __cplusplus //判断是不是c++文件
int main()
{
printf("%d %s\n",123,ToString(123));
printf("%d %d %s",1,2,"a" "我晕死了!\0" "666");
//请赐予我一下些变量吧!
int VAR(First) = 1;
int VAR(Tail) = 2;
int VAR(Cur) = 3;
printf("\n%d %d %d\n",numFirst,numTail,numCur);
putchar(97);
putchar(ToChar(97));
return 0;
}
点击查看代码
```city.h```:
"咸阳",
"西安",
"陕西"
```city.c```:
#include <stdio.h>
#include <string.h>
static char city_name[][20] = {
#include "city.h" //用gcc -E 宏展开run看看就是city.h文件的数据
};
int main()
{
{
for(int i = 0;i < 3;i++)
printf("%s\n",city_name[i]);
}
}
点击查看代码
//滥用宏定义
#define BEGIN {
#define END }
#define qwq 0
#include <iostream>
using namespace std;
int shuzu()
{
int a[10] = {0,2,4,6,8};
printf("a[1] == %d\n",1[a]);
printf("a<:1:> == %d\n",a<:1:>);
printf("2<:a:>%d\n",2<:a:>);
printf("sizeof 也是关键字\na_szie=%d\n:",sizeof a);
}
int add(int a,int b)
<%
if(!a)return b;
return add((a & b) << 1,a ^ b);
%>
int main()
BEGIN
int n;cin >> n;
int sum = qwq;
int i = n;
shuzu();
int x = 10;
cout << "x:" <<(x--> 0) << endl;
//逼近
while(x --> 0)
{
cout << x << endl;
}
code:
sum = add(sum,i);
if(i --> qwq)goto code;
cout << sum << '\n';
return qwq;
END
点击查看代码
#include <iostream>
#define fasle 1
#define true 0
using namespace std;
struct ZDJD
{
bool O(bool x)
{
return x ? true : false;
}
}o;
int main()
{
int a[] ={1,2,3,4,5};
int ans = 0;
for(int i = 0;i < 5;i++)
{
if(o.O((i - 1)[a + 1] % 2 == 0))
{
ans -= 0xffffffff;//-1
cout << ans << "\n";
}
}
return 0;
}
点击查看代码
#include <iostream>
using namespace std;
void encode(int x);
void encode2(int x);
int main()
{
int x1 =1,x2 =x1,x3=x2,x4 = x3;
x1 <<= 1; //x *= 2;
x2 >>= 1; //x /= 2;
x3 = (x3 << 1)+ (x3 << 3);//x *= 10;
for(int i = 0;i < 8;i++)
{
x4 <<= i;
cout << x4 << endl;
}
cout << x1 << "\n";
cout << x2 << "\n";
cout << x3 << "\n";
cout << "\n" <<endl;
//swap var
int a = 5,b = 3;
//异或(^) 俩1为0,单1为1,双零为0
a^=b,encode2(a),encode2(b);//a:110 = a:011 ^ b:101 a:6
cout << "a:" <<a <<"\n"<< "b:" <<b <<"\n" << endl;
b^=a,encode2(a),encode2(b);//b:101 = a:110 ^ b:011 b:5
cout << "a:" <<a <<"\n"<< "b:" <<b <<"\n" << endl;
a^=b,encode2(a),encode2(b);//a:011 = a:110 ^ b:101 a:3
cout << "a:" <<a <<"\n"<< "b:" <<b <<"\n" << endl;
//异或替换不等号
if(int c=(a ^ b))cout << "不相等" << c << '\n';
else cout << "相等" << '\n';
//异或字符
int x = 6;
char ch = x ^ 48;
cout << ch << '\n';
int y = ch ^ 48;//y = ch - '0';
cout << y << '\n';
return 0;
}
#if 0
void encode(int n)
{
for (int i = 8; i >= 0; i--)
{
if((n>>i)&1)
{
printf("1");
}
else
{
printf("0");
}
}
printf("\n");
}
#endif
void encode2(int x)
{
for(int i=7;i >=0;--i){cout<< ((x>>i)&i) <<"";}
cout << '\n';
}