这道题可以用头插法创建列表,然后正常输出: #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; 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 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…
这里用的是冒泡排序 #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 =…
如果编译不通过,可以将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 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 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(…
一:作用域 在ES6之前,javascript没有块级作用域(一对{}即为一个块级作用域),只有全局作用域和函数作用域(局部),因此,对应的有全局变量和局部变量.在函数内部可以访问到全局变量,但在函数外部,访问不到局部变量: (思考: function test(){ console.log(i);  //?      console.log(num);//? for(var i=0;i<1;i++){ var num=i; } } ) 二:链式作用域结构 在js中,变量查找遵循就近原则,如果同…