From d44fdd94e90e9ba652407ecb5f33fdc792346f46 Mon Sep 17 00:00:00 2001 From: pi5fnqcfr <824659727@qq.com> Date: Wed, 10 Jan 2024 09:42:53 +0800 Subject: [PATCH] ADD file via upload --- daochu.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 daochu.cpp diff --git a/daochu.cpp b/daochu.cpp new file mode 100644 index 0000000..736271d --- /dev/null +++ b/daochu.cpp @@ -0,0 +1,20 @@ +#include +#include +#include +#include"book.h" +#include"library.h" +using std::cout; +using std::cin; +using std::endl; +extern Book booklist[50]; +extern int num; +void wxy::daochu() +{ + std::ofstream ofile("booklist.txt"); + ofile << num << '\n'; + for (int i = 0; i < num; i++) + { + ofile << booklist[i].Name << ' ' << booklist[i].Auther << ' ' << booklist[i].amount << '\n'; + } + ofile.close(); +} \ No newline at end of file