24小时热门版块排行榜    

查看: 433  |  回复: 2

zyj8119

木虫 (著名写手)

[交流] 【求助】一个C++程序,改来改去就是有一个错误,找不出来了 已有1人参与

CODE:
#include
#include


int  select(int n,char a[],int b[])
{     int i=0,count=0;
      while(i                   while(!(a[i]>='0'||a[i]<='9')){
                          i++;
                          if(i>=n||!a[i])
                                  break;
                  }
                  if(i>=n)break;
                  b[count]=a[i]-'0';i++;
                  while(a[i]>='0'&&a[i]<='9'){
                          b[count]=10*b[count]+(a[i]-'0');
                          i++;
                  }
                  count++;
          }
                  return count;
}

          void main(void)
          {    int count;
               char a[100];
                   int b[50];
                   cout<<"输入字符串,长度小于100:\n";
                   cin.getline(a,100);
                   count=select(a,strlen(a),b);
                   cout<<"count="<                    for(int i=0;i                            cout<                    cout<           }

--------------------Configuration: hggg - Win32 Debug--------------------
Compiling...
hggg.cpp
C:\Program Files\Microsoft Visual Studio\Common\MSDev98\My Projects\hggg.cpp(30) : error C2664: 'select' : cannot convert parameter 1 from 'char [100]' to 'int'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Error executing cl.exe.

hggg.obj - 1 error(s), 0 warning(s)
使用VC编译的。
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

好好学习,天天向上。
已阅   关注TA 给TA发消息 送TA红花 TA的回帖

yalefield

金虫 (文坛精英)

老汉一枚

★ ★
zyj8119(金币+10):谢谢老汉,C++水平太烂,哎。。。 2010-11-05 09:19:06
ajian04(金币+2):谢谢交流~ 2010-11-05 17:44:12
是不是又偷看老TAN的书了?

(1)select自身
CODE:
int  select(int n,char *a,int *b)

(2)对select的调用
CODE:
count=select(strlen(a),a,b);

参数的次序也错了
2楼2010-11-05 09:06:09
已阅   关注TA 给TA发消息 送TA红花 TA的回帖

zyj8119

木虫 (著名写手)

引用回帖:
Originally posted by yalefield at 2010-11-05 09:06:09:
是不是又偷看老TAN的书了?

(1)select自身
CODE:
int  select(int n,char *a,int *b)

(2)对select的调用
CODE:
count=select(strlen(a),a,b);

参数的次序也错了

此帖结帖。
好好学习,天天向上。
3楼2010-11-05 09:19:23
已阅   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 zyj8119 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[论文投稿] 岩土工程学报什么时候才能终审完呐 25+3 yeager111 2026-08-10 4/200 2026-08-16 20:42 by tfang
[基金申请] 时间戳又变了8-15 +13 archvillain 2026-08-15 25/1250 2026-08-16 20:13 by zhaosm1982
[基金申请] 哪位老哥知道今年的国自然具体哪一天放榜? +9 Ldrop2023 2026-08-13 9/450 2026-08-16 13:24 by wukun_007
[基金申请] 咱们一起用铁证分析2026国家社科基金中标与否 +7 启萌科技 2026-08-12 26/1300 2026-08-16 12:35 by 启萌科技
[基金申请] filecode +8 cratir 2026-08-14 12/600 2026-08-15 18:08 by zyfgau
[基金申请] 关于Filecode分析方法 +10 majunge000 2026-08-10 13/650 2026-08-15 12:26 by hanpeng972
[基金申请] 各位道友,我要去昆明玩几天,回来见。 +7 Tide man 2026-08-14 8/400 2026-08-15 01:11 by arzu_hma
[硕博家园] 读博的好处 +4 lnee 2026-08-11 4/200 2026-08-14 10:20 by ahsoarli
[基金申请] filecode +15 documentary 2026-08-10 17/850 2026-08-14 10:08 by kissu88
[基金申请] FileCode能看出啥? +10 要乐观耀哥 2026-08-10 32/1600 2026-08-14 09:37 by 要乐观耀哥
[基金申请] 静等基金结果 +8 gjjjzhong 2026-08-10 21/1050 2026-08-13 17:56 by 且听虎啸
[基金申请] 重要来源:本周末出结果 +10 瞬息宇宙 2026-08-12 10/500 2026-08-13 15:46 by likettle
[基金申请] 不应该看fileCode +7 且听虎啸 2026-08-12 9/450 2026-08-13 14:27 by flydreamws
[基金申请] Filecode 又变了,巨变 +3 WH3796 2026-08-12 4/200 2026-08-13 14:13 by 小木虫6752397
[基金申请] 分享一下我之前已中青C的计划书的filecode +4 布布和一二 2026-08-11 5/250 2026-08-13 12:56 by cratir
[基金申请] 帮忙看看fileCode +7 wwncly 2026-08-10 13/650 2026-08-11 19:36 by 冰心玉壶晴
[基金申请] 为什么网上很多人说本周 12号出结果 +6 瞬息宇宙 2026-08-10 7/350 2026-08-11 19:25 by Tide man
[基金申请] 什么时候出结果,有咨询渠道??? +3 Tide man 2026-08-11 3/150 2026-08-11 17:54 by kudofaye
[基金申请] 确定了,国自然21号放榜 +6 布布和一二 2026-08-10 7/350 2026-08-10 19:15 by 2000zf36392
[基金申请] 国自然结果 +4 Vierhys 2026-08-10 8/400 2026-08-10 15:06 by Vierhys
信息提示
请填处理意见