#include<stdio.h> #include<stdlib.h> #define MAX 1000 typedef struct{ double no; char name[MAX]; double price; }Book; void createList(Book b[],int len); void traverse(Book b[],int len); int main() { Book book[MAX]; int len; scanf("%d"…
#include<stdio.h> #include<stdlib.h> #define MAX 1000 typedef struct{ double no; char name[MAX]; double price; }Book; int createList(Book b[]); void traverse(Book b[],int len); void sortList(Book b[],int len); int main() { Book book[MAX]; int…
这道题可以用头插法创建列表,然后正常输出: #include<stdio.h> #include<stdlib.h> #define MAX 100 typedef struct Book{ double no; char name[MAX]; double price; struct Book * next; }Book,*BList; //头插法创建链表 void CreatList(BList &B) { B = (BList)malloc(sizeof(Book))…
#include<stdio.h> #include<stdlib.h> #define MAX 1000 typedef struct{ double no; char name[MAX]; double price; }Book; int createList(Book b[]); void traverse(Book b[],int len); double average(Book b[],int len); void add(Book b[],int len,double…
#include<stdio.h> #include<stdlib.h> #define MAX 1000 typedef struct{ double no; char name[MAX]; double price; }Book; void createList(Book b[],int len); double getElem(Book book[],int len); void traverse(Book b[],int len,double max); int main(…
#include<stdio.h>#include<stdlib.h>#define MAX 100 typedef struct bNode{ double no; char name[MAX]; double price; struct bNode * next;}bNode,*bLnode; bLnode createData(bLnode B);void traverse(bLnode B); int main(){ bLnode book; book = createDa…
如果编译不通过,可以将C该为C++ #include<stdio.h> #include<stdlib.h> #define MAX 100 //创建节点 typedef struct Book{ double no; char name[MAX]; double price; struct Book * next; }Book,*BList; //创建链表 void CreatList(BList &B,int n) { B = (BList)malloc(sizeof(…
这里用的是冒泡排序 #include<stdio.h> #include<stdlib.h> #define MAX 100 typedef struct Book{ double no; char name[MAX]; double price; struct Book * next; }Book,*BList; void CreatList(BList &B) { B = (BList)malloc(sizeof(Book)); B->next = NULL; B…
#include<stdio.h> #include<stdlib.h> #define MAX 100 typedef struct Book{ double no; char name[MAX]; double price; struct Book * next; }Book,*BList; //创建列表 void CreatList(BList &B) { //头插法创建单链表 B = (BList)malloc(sizeof(Book)); B->next =…
一.typedef 关键字 1. 简介: typedef工具是一个高级数据特性,利用typedef可以为某一些类型自定义名称. 2. 工作原理: 例如我们定义链表的存储结构时,需要定义结点的存储数据元素的类型,如定义一个 int 类型的ElemType,我们可以在定义前    面加上关键字typedef即可: typedef int ElemType; 随后我们便可以用ElemType来定义上述数据元素的类型了: ElemType data; 二.对下述结构指针定义的理解 typedef int…