软件技术基础实验1
时间:2026-01-16
时间:2026-01-16
软件技术基础实验1
/* Note:Your choice is C IDE */
#include "stdio.h"
//main()
//{
//}
// 头文件 sqlist.h的内容如下:
#include<stdio.h>
//#include"sqlist.h"
#define OVERFLOW 0
//#define NULL 0
#define OK 1
#define MAXSIZE 1024
typedef int elemtype;
typedef struct
{ elemtype vec[MAXSIZE];
int len;
}sequenlist;
int createsqlist(sequenlist *L,int k)
{ int i;
for( i=0;i<k;i++)
scanf("%d", &L->vec[i]);
return OK;
}
// 以下是整个源程序:
void main()
{ int i,n,k1,k2;
sequenlist *L,a;
printf("\n Input the length of the list L:\n");
scanf("%d",&n);
L=&a;
L->len=n;
createsqlist(L,n);
printf("Output the list and its length:\n");
fo
r(i=0;i<L->len;i++)
printf("%d ", L->vec[i]);
printf("\nThis sequenlist's length is %d", L->len);
}
上一篇:优秀民营企业先进事迹