求助 c语言 高手~ 为什么这个程序运行不了

[复制链接]
查看11 | 回复2 | 2010-1-4 16:47:51 | 显示全部楼层 |阅读模式
给你改好了:#include#includeint str2int(char s[], int m){ int i; long n=0; if(s[0]=='0') {
if(s[1]=='x' || s[1]=='X')
{
i=2;
do
{
n=n*16+(s<='9'? s-'0': s-'A'+10);
i++;
}while(s!='\0');
}
else
{
i=1;
do
{
n=n*8+s-'0';
i++;
}while(s!='\0');
} } else
{
i=0;
while(s!='\0')
{
n=n*10+s-'0';
i++;
} }
return n;}main(){
char s[80]; gets(s); printf("%ld\n", str2int(s, strlen(s)));//system("PAUSE");}循环写得有点过于业余了,其他还有些小错,要是编程初学者先学着编点简单的东西。
回复

使用道具 举报

千问 | 2010-1-4 16:47:51 | 显示全部楼层
你这是弄的什么东西啊。你里面有两个str2int函数,头文件#include也到处乱放。 编译一下看看错误就知道是什么问题了,你有两个名字为str2int的函数当然是错误的。。
回复

使用道具 举报

千问 | 2010-1-4 16:47:51 | 显示全部楼层
不能运行不奇怪,这个程序能运行才奇怪呢
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行