You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
python/TangDou/AcWing/MiniPath/POJ上的奇奇怪怪的CompileError.md

40 lines
1.0 KiB

## 【C语言语法】 POJ上奇奇怪怪的Compile error
>收集中,因为老在$POJ$上莫名奇妙地$CE$,所以记录一下出现过的错误
### 1.不能用万能头文件`<bits/stdc++.h>`
**懒癌克星**
### 2.不支持以{}的形式为结构体赋值:
```c++
typedef struct{
int x,y,z;
int step;
}pos;
pos S;
queue <pos> q;
//以下三种方式都不行
S={i,j,k,0};
S=pos{i,j,k,0};
q.push({new_x,new_y,new_z,new_step});
```
### 3.需要加`<string>`头文件才能实现对`string`类型的某些操作
$string$类型判断两个字符串是否相等可以直接用$==$
但是在$poj$上没加`<string>`头文件会$CE$,我自己的编译器上不会,不知道是什么原因
### 4.不能以变量作为数组的`size`
```c++
while(cin>>N&&N){
string s[N+1];
}
```
显示:
<center><img src='https://img-blog.csdnimg.cn/20201118194110805.png'></center>
### 5.不能用`distance`作为函数名
貌似与`xutility`中的一个函数重名了?