C++中的strchr在哪里?

Loo*_*out 1 c c++ c++11

我知道那strchr是在<string>.但是uva10082给了CE:

code.cpp: In function ‘int main()’:
code.cpp:6:13: warning: unknown escape sequence: '\A'
char x[] = "`1234567890-=QWERTYUIOP[]\ASDFGHJKL;'ZXCVBNM,./";          ^
code.cpp:11:24: error: ‘strchr’ was not declared in this scope
p = strchr(x, char(c));
Run Code Online (Sandbox Code Playgroud)

这是我的代码:(用c ++ 11编译)

#include<iostream>
#include<string>
using namespace std;
int main()
{
    char x[] = "`1234567890-=QWERTYUIOP[]\ASDFGHJKL;'ZXCVBNM,./";
    int c;
    char* p = NULL;
    while ((c = getchar()) != EOF)
    {
        p =strchr(x,char(c));
        if (p)
            cout << *(p-1);
        else
            cout << char(c);
    }
}
Run Code Online (Sandbox Code Playgroud)

nas*_*-sh 6

#include <cstring>  // contains strchr
Run Code Online (Sandbox Code Playgroud)

此外,没有必要将第二个参数投射到char,因为那里strchr需要int