From cf8057ed6bcf1a1bb27615f93c6b28d0dfae175e Mon Sep 17 00:00:00 2001 From: msksbr Date: Sat, 19 Oct 2024 15:47:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E9=A2=98=E8=BD=BB=E8=BD=BB?= =?UTF-8?q?=E6=9D=BE=E6=9D=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- homework2/CMakeLists.txt | 4 ++++ homework2/test3.cpp | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 homework2/test3.cpp diff --git a/homework2/CMakeLists.txt b/homework2/CMakeLists.txt index b651fc5..a8d698f 100644 --- a/homework2/CMakeLists.txt +++ b/homework2/CMakeLists.txt @@ -10,3 +10,7 @@ add_executable(test2 test2.cpp LinkList.h LinkList.cpp ) +add_executable(test3 test3.cpp + LinkList.h + LinkList.cpp +) diff --git a/homework2/test3.cpp b/homework2/test3.cpp new file mode 100644 index 0000000..11489e2 --- /dev/null +++ b/homework2/test3.cpp @@ -0,0 +1,21 @@ +//test3.cpp +#include +#include"LinkList.h" +using namespace std; + +void alter_to_110_percent(bookList &l) { + bookNode *temp = l->next; + while (temp != NULL) { + temp->price *= 1.1; + temp = temp->next; + } +} + +int main() { + bookList books = new bookNode; + books->next = NULL; + create(books); + alter_to_110_percent(books); + display(&books); + return 0; +}