#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 scopeitoa(i*i,ch,m);^輔助解釋:error: ‘itoa’ was not declared in this scope:函數(shù)或變量沒(méi)有聲明過(guò)就進(jìn)行調(diào)用,檢查下是否導(dǎo)入了正確的頭文件
1 回答

侃侃無(wú)極
TA貢獻(xiàn)2051條經(jīng)驗(yàn) 獲得超10個(gè)贊
itoa?這個(gè)是非標(biāo)準(zhǔn)函數(shù)啊,你用sprintf來(lái)替代吧。這種函數(shù)最好還是別用,即是能過(guò),但換個(gè)平臺(tái)編譯可能還會(huì)出錯(cuò)
- 1 回答
- 0 關(guān)注
- 102 瀏覽
添加回答
舉報(bào)
0/150
提交
取消