BJFU-207-基于顺序存储结构的图书信息表的逆序存储
#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",&len); createList(book,len); traverse(book,len); return 0; } void createList(Book b[],int len) { for(int i=0;i<len;i++) { scanf("%lf",&b[i].no); scanf("%s",&b[i].name); scanf("%lf",&b[i].price); } } void traverse(Book b[],int len) { for(int i=len-1;i>=0;i--) { printf("%.0lf ",b[i].no); printf("%s ",b[i].name); printf("%.2f",b[i].price); printf("\n"); } }