24小时热门版块排行榜    

查看: 435  |  回复: 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的回帖

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的回帖
查看全部 3 个回答

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的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 今天系统多次维护,明天很可能放榜! +5 zju2000 2026-08-16 5/250 2026-08-16 23:23 by Haru815
[基金申请] 欢迎发来filecode的Mz6后的代码验证其规律 +32 医学老男孩 2026-08-13 74/3700 2026-08-16 21:05 by 医学老男孩
[基金申请] 时间戳又变了8-15 +13 archvillain 2026-08-15 25/1250 2026-08-16 20:13 by zhaosm1982
[基金申请] 2027广东省杰青 +3 奶牛小黑 2026-08-15 6/300 2026-08-16 20:07 by 奶牛小黑
[基金申请] 快农历七夕节了,轻松一下,男人悄悄话,女施主请不要进来。 +3 Tide man 2026-08-14 3/150 2026-08-16 17:47 by jurkat.1640
[精细化工] 招聘 金属平磨液,抛光液研发工程师 +3 小天0311 2026-08-14 3/150 2026-08-16 07:31 by H9PLUS
[基金申请] 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 yuleib84 2026-08-11 4/200 2026-08-14 23:05 by lfy8008
[基金申请] 奇怪,两个人的filecode固定段从头到尾一模一样 +8 布布和一二 2026-08-10 11/550 2026-08-14 14:58 by Equinoxhua
[基金申请] filecode +15 documentary 2026-08-10 17/850 2026-08-14 10:08 by kissu88
[基金申请] Filecode 又变了,巨变 +3 WH3796 2026-08-12 4/200 2026-08-13 14:13 by 小木虫6752397
[基金申请] 结合人工智能,周易传统文化,filecode打分制来了,3分以上希望很大。 +3 Tide man 2026-08-12 4/200 2026-08-13 08:35 by ZJTJZ
[基金申请] 2019年青年基金涵评意见,大家看看几个A,几个B? +11 Tide man 2026-08-11 11/550 2026-08-13 07:35 by 撸猫猫
[基金申请] 帮忙看看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
信息提示
请填处理意见