我的这个C++的程序出错了,找人帮忙改下,把正确的写给我,带上出错原因。

[复制链接]
查看11 | 回复1 | 2010-12-7 17:14:42 | 显示全部楼层 |阅读模式
#include
using namespace std;
int count (char a[]);
void main ()
{
char b[100];
int i,j=0;
cout=97&&b<=122))
j++;
}
return j;
}
还是不对啊。
程序没错,但是无论输入什么,输出都是1

回复

使用道具 举报

千问 | 2010-12-7 17:14:42 | 显示全部楼层
//应该可以了#include using namespace std;int count (char b[]);void main (){ char b[100]; int i,j=0; cout<<"输入字符串:"<<endl; cin.getline(b,100);
i=count (b);
//调用时不能写count(b[100]),
//而且返回值是int类型,不是char[]类型,不能那样写 cout<using namespace std;int count (char a[]);void main (){ char b[100]; int i,j=0; cout<<"输入字符串:"<<endl; cin.getline(b,100); i=count (b); cout<<i
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行