exercises 1.25
1 #include <iostream> 2 #include "Sales_item.h" 3 using namespace std; 4 5 int main() 6 { 7 Sales_item total; 8 if(cin>>total){ 9 Sales_item book; 10 while(cin>>book){ 11 if(total.isbn()==book.isbn()){ 12 total+=book; 13 }else{ 14 cout<<total<<endl; 15 total=book; 16 } 17 18 } 19 cout<<total<<endl; 20 }else{ 21 cout<<"data error"<<endl; 22 return -1; 23 } 24 return 0; 25 }

浙公网安备 33010602011771号