C语言,小问题,大家帮忙
int *quick(int a[],int low,int high)
{ int i,j,t;
if (low<high)
{ i=low;j=high;t=a[low];
while (i<j)
{ while ((i<j)&&(a[j]<t)) j--;
if (i<j) a[i++]=a[j];
while ((i<j)&&(a[i]>t)) i++;
if (i<j) a[j--]=a[i];
}
a[i]=t;
quick(a,low,i-1);
quick(a,i+1,high);
}
return(a);
}
main()
{ int i,s[20],*t,n;
printf("Enter 10 numbers to s[]:\n");
for (i=0;i<10;i++)
scanf("%d",&s[i]);
t=quick(s,0,9);
for (i=0;i<10;i++)
printf(" %d ",t[i]);
}
2
#include"string.h"
main()
{ char a[30]={'n','g','z','q','t','c','o','b',
'm','u','h','e','l','k','p','d',
'a','w','x','f','y','l','v','r',
's','j'};
char b[30];
int i,n;
printf("\n Enter your strings:\n");
gets(b);
n=strlen(b);
printf("\n");
for (i=0;i<n;i++)
printf("%c",a[b[i]-'a']);
printf("\n");
}
int partition(Seqlist R,int i,int j)
{ RecType pivot=R[i];
while (i<j)
while (i<j && R[i].key>=pivot.key)
j--;
if (i<j)
R[i++]=R[j];
while (i<j && R[i].key<=pivot.key)
i++;
if (i<j)
R[j--]=R[i];
R[i]=pivot;
return i;
}
void QuickSort(Seqlist R,int low,int high)
{ int pivotpos;
if (low<high)
pivotpos=partition(R,low,high);
QuickSort(R,low,pivotpos-1);
QuickSort(R,pivotpos+1,high);
}
main()
{
}
提示好像是ERRON LINKS,有COS.OBJ有关\\
说是不能OPEN 和INTUP
以上三题,我编译都不能过,不知道什么原因,大家多多帮忙..