#include <bits/stdc++.h>
using namespace std;
int x=1;
bool dgpd (int i;int n)
{
if (n-x==0||n-x==1) return true;
if (i%pow(10.0,n*1.0)==i%pow(10.0,x*1.0))
{
x++;
return dgpd(i,n+1);
}
}
bool hws (int i)
{
int j=i,sum;
while (i/10==0)
{
i/=10;
sum++;
}
sum++;
i=j;
return dgpd (i,sum);
}
bool zs (int i)
{
for (int j=2;j<i;j++)
{
if (i%j==0) return false;
}
return true;
}
int main ( )
{
int a,b;
cin>>a>>b;
for (int j=a;j<=b;j++)
{
if(zs(j)&&hws(j)) cout<<j<<endl;
}
return 0;
}
编译显示错误:
/tmp/compiler_11_hhsfn/src:4:17: 错误:expected ‘)’ before ‘;’ token bool dgpd (int i;int n) ~ ^ ) /tmp/compiler_11_hhsfn/src:4:23: 错误:expected initializer before ‘)’ token bool dgpd (int i;int n) ^ /tmp/compiler_11_hhsfn/src: 在函数‘bool hws(int)’中: /tmp/compiler_11_hhsfn/src:24:23: 错误:too many arguments to function ‘bool dgpd(int)’ return dgpd (i,sum); ^ /tmp/compiler_11_hhsfn/src:4:6: 附注:在此声明 bool dgpd (int i;int n) ^~~~ 这是怎么回事呀?在网上都查不到这个错误的解决方法,请大犇指导!