c++ - 'strrev' 未在此范围内声明
问题描述
编译后我得到“此代码中未声明 strrev”,似乎我不能在 strcpy 中使用 strrev?如果是这样,将 strrev(b) 的值分配给 char 数组会解决它吗?这是代码:
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("palindrom.in");
ofstream fout("palindrom.out");
int main(){
int i, n = 0, x, v[100], q=0;
char a[256], b[256], rev[256], be[256];
int ind=0;
fin>>x;
fin.get();
for(i = 0; i < x; i++){
fin.get(a, 256);
fin.get();
for(int j = 0; j < strlen(a); j++){
if(!strchr(" ", a[j])){
b[n++] = a[j];
}
}
b[n++] = 0;
strcpy(be, b);
strcpy(rev, strrev(b));
if(strcmp(be, rev) == 0){
v[ind++] = 1;
}
else{
v[ind++] = 0;
}
memset(b, 0, 256);
n = 0;
}
for(i = 0; i < x; i++){
fout<<v[i]<<endl;
}
}
解决方案
推荐阅读
- django - Django 2.1 - 'WhereNode' 对象没有属性 'output_field' 错误
- python - Python将多个文件模块中的所有内容导入命名空间
- python - 使用 BeautifulSoup 和 Python 抓取数据
- javascript - Node.js 导出属性
- data-binding - 我可以绑定到 Xamarin 表单中的全局内容吗?
- c++ - 如果在同一个翻译单元中调用函数,为什么需要重定位
- python - 如果客户端停止(SIGSTOP),Python TCP 服务器将永远阻塞发送到客户端
- excel - 使用excel中的高级过滤器过滤掉旧日期
- c# - Math.Sin 给了我奇怪的值
- ios - 可在 Swift 中使用子类进行解码