读书人

谁给小弟我看看 小弟我写的程序错在哪

发布时间: 2012-01-23 21:57:28 作者: rapoo

哪位高手给我看看 我写的程序错在哪了?
下面这段程序 能编译通过 但链接时出错了 怎么回事?
#include <stdio.h>
#include <stdlib.h>

void ShellSort(int *array,int high);
void ShellInsert(int *array,int high,int gap);

int main (void)
{
int num=10;
int temp[10]={10,2,23,14,8,19,18,15,18,1};
int low1=0;
int high1=num-1;
puts( "the date before sort: ");
for( int i=0;i <num;i++)
{
printf( "%4d ",temp[i]);
}
printf( "\n ");

ShellSort(temp,high1);
puts( "the date after sort: ");
for( i=0;i <num;i++)
{
printf( "%4d ",temp[i]);
}
printf( "\n ");
return 0;
}

void ShellSort(int * array,int high)
{

int gap=(high+1)/2;
while(gap)
{

ShellInsert(array,high,gap);

gap=gap==2?1:(int)(gap/2);
}
}

void shellInsert(int *array,int high,int gap)
{

int tempdata,i,j;
for(i=gap;i <=high;i++)
{
tempdata=array[i];
j=i;
while(j> gap&&tempdata <array[j-gap])
{
array[j]=array[j-gap];
j-=2;
}
array[j]=tempdata;
}
}


[解决办法]
声明时void ShellInsert(int *array,int high,int gap);
定义时void shellInsert(int *array,int high,int gap)

s大小写不一样, 给我分.

读书人网 >VC/MFC

热点推荐