为什么我在IDE里是对的,OJ上就过不了

#include<bits/stdc++.h>
#include <windows.h>
using namespace std;
bool check(int x)
{
int rx=0,s;
s=x;
while(x!=0)
{
rx=rx*10+(x%10);
x/=10;
}
if(rx==s)
{
return true;
}
return false;
}
int main() 

int n,m,s=0;
long long x;
char ch[1001]; 
cin>>n>>m;
for(int i=1;i<=n;i++)
{
itoa(i*i,ch,m);
x=atol(ch);
if(check(x)==true)
{
s++; 
}
}
cout<<s<<endl;
return 0; 
}

Main.cc: In function ‘int main()’:
Main.cc:26:16: error: ‘itoa’ was not declared in this scope
itoa(i*i,ch,m);
^
辅助解释:
error: ‘itoa’ was not declared in this scope:函数或变量没有声明过就进行调用,检查下是否导入了正确的头文件

MMTTMM
浏览 141回答 1
1回答

侃侃无极

itoa?这个是非标准函数啊,你用sprintf来替代吧。这种函数最好还是别用,即是能过,但换个平台编译可能还会出错
打开App,查看更多内容
随时随地看视频慕课网APP