主题:高手指点,我这程序错误怎么改
#include<stdio.h>
#include<malloc.h>
#define SIZE 10
#define LEN sizeof(struct link)
struct link
{
int num;
int A[SIZE];
};
int main()
{int delet (struct link *P,int num,int i);
int a,i=0;
char c;
struct link line;
line.num=0;
do
{ scanf("%d",&a);
line.A[i++]=a;
c=getchar();
line.num++;
}while(c!='\n'&&i<SIZE);
delet(line,3);
line.num--;
for(i=0;i<line.num;i++)
printf("%d",line.A[i]);
scanf("%d",&a);
}
int delet(struct link &Line,int i)
{
if(i<0||i>Line.num){
printf("data error");
return 0;}
else if(Line.num>SIZE-1)
{printf("link full!");
return 0;}
else {
while(i!=Line.num)
Line.A[i]=Line.A[i+1];
}
}
题意是顺序表的删除
#include<malloc.h>
#define SIZE 10
#define LEN sizeof(struct link)
struct link
{
int num;
int A[SIZE];
};
int main()
{int delet (struct link *P,int num,int i);
int a,i=0;
char c;
struct link line;
line.num=0;
do
{ scanf("%d",&a);
line.A[i++]=a;
c=getchar();
line.num++;
}while(c!='\n'&&i<SIZE);
delet(line,3);
line.num--;
for(i=0;i<line.num;i++)
printf("%d",line.A[i]);
scanf("%d",&a);
}
int delet(struct link &Line,int i)
{
if(i<0||i>Line.num){
printf("data error");
return 0;}
else if(Line.num>SIZE-1)
{printf("link full!");
return 0;}
else {
while(i!=Line.num)
Line.A[i]=Line.A[i+1];
}
}
题意是顺序表的删除