冷知识
  • 板块灌水区
  • 楼主shiyiming
  • 当前回复11
  • 已保存回复11
  • 发布时间2025/1/17 14:30
  • 上次更新2025/1/17 16:58:58
查看原帖
冷知识
992990
shiyiming楼主2025/1/17 14:30

在c++中 <: 可以代替[], 于是我们可以写出以下代码

#include<iostream>
using namespace std;
int main(){
	int a[10]={1,2,3,1919810,5,6,7,8,9,114514};
	cout<<a[3]<<endl;
	cout<<3[a]<<endl;
	cout<<1[a+2]<<endl;
	cout<<(1<:a+2:>)<<endl;
	cout<<(114514<:a-114511:>)<<endl;
	cout<<(&a[2])[1]<<endl;
	cout<<(&a[4])[-1]<<endl;
	cout<<(&(2<:a+2:>))<:-1:><<endl;
	cout<<(&(&(-5)<:a+4:>)<:7:>)<:-3:><<endl;
	return 0;
}
2025/1/17 14:30
加载中...