首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

这是一个判别一个数组是不是数字的程序,有有关问题,请大家进来看看.

2012-02-23 
这是一个判别一个数组是不是数字的程序,有问题,请大家进来看看.boolisnumber(char&a[])----------1{inti(0

这是一个判别一个数组是不是数字的程序,有问题,请大家进来看看.
bool   isnumber(char   &a[])                                         ----------1
{
int   i(0);
bool   flat=1;     //假定是数字
        while(*(a+i)!= '\0 ')
          {
            if(*(a+i)> 0   &&   *(a+i) <9)                             ----------2
            i++;
            else  
            {
            flat=0;
            break;
            }
}
return   flat;
}
1:
  error   C2234:   ' <Unknown> '   :   arrays   of   references   are   illegal
2:
  error   C2446:   ' < '   :   no   conversion   from   'const   int '   to   'char   * '
                Conversion   from   integral   type   to   pointer   type   requires   reinterpret_cast,   C-style   cast   or   function-style   cast
error   C2040:   ' < '   :   'char   * '   differs   in   levels   of   indirection   from   'const   int '


[解决办法]
bool isnumber(char a[])
[解决办法]
指针 to 引用非法的,数组同样
~-~

热点排行