From 587ad6a38a056700d474f75445990f6c1d4d9727 Mon Sep 17 00:00:00 2001 From: cnhacklqr Date: Sun, 12 Nov 2023 16:00:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/type/ptr/Advanced/ptr_struct.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/type/ptr/Advanced/ptr_struct.cpp b/src/type/ptr/Advanced/ptr_struct.cpp index 42423ef..fb22acc 100644 --- a/src/type/ptr/Advanced/ptr_struct.cpp +++ b/src/type/ptr/Advanced/ptr_struct.cpp @@ -9,11 +9,10 @@ struct student { } studentList[3] = {{"SB1", 'F', 239}, {"SB2", 'F', 232}, {"SB3", 'M', 832}}; int main() { student *ptr; - cout << setw(9) << "Name " - << "Sex " + cout << setw(10) << "Name " << setw(4) << "Sex " << "Score " << endl; for (ptr = studentList; ptr < studentList + 3; ptr++) { - cout << setw(9) << ptr->name << " " << setw(1) << ptr->sex << " " + cout << setw(9) << ptr->name << " " << setw(3) << ptr->sex << " " << setw(3) << ptr->score << endl; } return 0;