Browse Source

修复了一些问题

Pchen. 10 months ago
parent
commit
48b80f69b4

+ 4 - 4
code/用静态数据成员和静态函数统计猫的数量——11-01.cpp

@@ -29,7 +29,7 @@ int Cat::HowManyCats = 0; // Initialize static data member
 
 // Function to create an array of 5 Cat objects with ages 1, 2, 3, 4, 5
 void creating() {
-    std::cout << "before the Cat array is created, the number of the cat is:" << Cat::GetHowMany() << std::endl;
+    std::cout << "before the Cat array is created,the number of the cat is:" << Cat::GetHowMany() << std::endl;
 
     Cat* cats[5]; // Array of pointers to Cat objects
 
@@ -38,7 +38,7 @@ void creating() {
         cats[i] = new Cat(i + 1);
     }
 
-    std::cout << "after the Cat array is created, the number of the cat is:" << Cat::GetHowMany() << std::endl;
+    std::cout << "after the Cat array is created,the number of the cat is:" << Cat::GetHowMany() << std::endl;
 
     // Delete the 5 Cat objects to free memory and reduce the count
     for (int i = 0; i < 5; ++i) {
@@ -47,11 +47,11 @@ void creating() {
 }
 
 int main() {
-    std::cout << "before the function, the number of the cat is:" << Cat::GetHowMany() << std::endl;
+    std::cout << "before the function,the number of the cat is:" << Cat::GetHowMany() << std::endl;
 
     creating();
 
-    std::cout << "after the function, the number of the cat is:" << Cat::GetHowMany() << std::endl;
+    std::cout << "after the function,the number of the cat is:" << Cat::GetHowMany() << std::endl;
 
     return 0;
 }