修复了打印输出问题
This commit is contained in:
+8
-4
@@ -49,10 +49,14 @@ void input(book *books, int n) {
|
|||||||
|
|
||||||
void output(book_and_number *books_and_number) {
|
void output(book_and_number *books_and_number) {
|
||||||
cout << books_and_number->number_of_books << endl;
|
cout << books_and_number->number_of_books << endl;
|
||||||
for (int i = 0; i < books_and_number->number_of_books; i++) {
|
for (int i = 0; true; i++) {
|
||||||
cout << books_and_number->books[i].id << " " << books_and_number->books[i].name << " " << fixed <<
|
if (books_and_number->books[i].price != 0) {
|
||||||
setprecision(2) <<
|
for (int j = 1; j < i + books_and_number->number_of_books; j++) {
|
||||||
books_and_number->books[i].price << endl;
|
cout << books_and_number->books[i].id << " " << books_and_number->books[i].name << " " << fixed <<
|
||||||
|
setprecision(2) << books_and_number->books[i].price << endl;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user