0
点赞
收藏
分享

微信扫一扫

顺序表图书信息

云朵里的佛光 2022-05-03 阅读 37
//顺序表图书信息
#include<bits/stdc++.h>
using namespace std;
#define Max 100
//定义
typedef struct book_data
{
	string book_number;
	string book_name;
	float book_price;
 } book_data;
 int main()
 {
 	book_data list[Max];
 	int n,m,t;
 	cin>>n;
 	for(int i=1;i<=n;i++){
 		cin>>list[i].book_number;
 		cin>>list[i].book_name;
 		cin>>list[i].book_price;
	 }
	 cin>>m;
	 for(int j=1;j<=m;j++){
	 	cin>>t;
	 	if(t<=n&&t>0)
	 	{
		 cout<<list[t].book_number<<" "<<list[t].book_name<<" ";
		 printf("%.2lf",list[t].book_price);
		 cout<<endl;
	    }
	 	else
	 	cout<<"Sorry,the book on the best position doesn't exist!"<<endl;
	 	
	 }
 }
 //注意换行 
 
举报

相关推荐

0 条评论