在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
#include <iostream> #include <stdio.h> using namespace std; #define OK 1 #define ERROR 0 #define OVERFLOW -2 int num=0; typedef struct Book { string IS; string Name; float price; Book *next; }Book,*PBook; PBook Create() { PBook Head=new Book; PBook Tail=new Book; PBook New; string t1,t2; float t3; Tail=Head; while(cin>>t1>>t2>>t3&&t3) { num++; New=new Book; New->IS=t1; New->Name=t2; New->price=t3; Tail->next=New; New->next=NULL; Tail=New; } return Head; } void Print(PBook pHead) { PBook p; p=pHead->next; cout<<num<<endl; while(p!=NULL) { cout<<p->IS<<" "<<p->Name; printf(" %.2f\n",p->price); p=p->next; } } int main() { PBook Head; Head=Create(); Print(Head); return 0; }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论