HW

ADS

hw1

Snipaste_2024-05-10_21-01-06

Snipaste_2024-05-10_21-01-14

编程题:Root of AVL Tree

hw2

Snipaste_2024-05-10_21-02-50

Snipaste_2024-05-10_21-02-58

Snipaste_2024-05-10_21-03-05

Snipaste_2024-05-10_21-03-13

Snipaste_2024-05-10_21-03-20

编程题:Self-printable B+ Tree

hw3

Snipaste_2024-05-10_21-07-58

Snipaste_2024-05-10_21-08-12

Snipaste_2024-05-10_21-08-21

编程题:Document Distance

hw4

Snipaste_2024-05-10_21-11-38

Snipaste_2024-05-10_21-11-57

Snipaste_2024-05-10_21-12-06

Snipaste_2024-05-10_21-12-14

Snipaste_2024-05-10_21-13-09

程序填空题比大小搞反了

hw5

Snipaste_2024-05-10_21-19-45

Snipaste_2024-05-10_21-19-52

Snipaste_2024-05-10_21-20-07

hw6

Snipaste_2024-05-10_21-21-46

编程题:Werewolf

hw7

Snipaste_2024-05-10_21-22-33

Snipaste_2024-05-10_21-22-40

Snipaste_2024-05-10_21-22-47

midterm

。。。https://pintia.cn/problem-sets/1781129330240528384/exam/problems/type/1

hw8

Snipaste_2024-05-10_21-24-23

Snipaste_2024-05-10_21-24-31

函数题:Programming Contest

hw9

Snipaste_2024-05-10_21-27-11

编程题:To Fill or Not to Fill

hw10

Snipaste_2024-05-10_21-28-11

Snipaste_2024-05-10_21-28-22

  • 正解:

补充题目可以看这里:https://blog.csdn.net/HGGshiwo/article/details/118367178


OOP

hw1.5

Snipaste_2024-05-10_21-05-55

hw2.5

  • 正解:C (20 pointers)

Snipaste_2024-05-10_21-14-59

hw3.5

#include <iostream>

struct X {
    X() {
        std::cout << "X::X()" << std::endl;
    }
    ~X() {
        std::cout << "X::~X()" << std::endl;
    }
};

struct Y {
    Y() {
        std::cout << "Y::Y()" << std::endl;
    }
    ~Y() {
        std::cout << "Y::~Y()" << std::endl;
    }
};

struct Parent {
    Parent() {
        std::cout << "Parent::Parent()" << std::endl;
    }
    ~Parent() {
        std::cout << "Parent::~Parent()" << std::endl;
    }
    X x;
};

struct Child : public Parent {
    Child() {
        std::cout << "Child::Child()" << std::endl;
    }
    ~Child() {
        std::cout << "Child::~Child()" << std::endl;
    }
    Y y;
};

int main() {
    Child c;
}

hw4.5

#include <iostream>
using namespace std;

class A
{
public:
  A(int i) : mi(i) {}
  A(const A& rhs) : mi(rhs.mi)
  {
    cout << "A::A(&)" << endl;
  }
  A& operator=(const A&rhs)
  {
    mi = rhs.mi;
    cout << "A::operator=()" << endl;
    return *this;
  }
  virtual void f()
  {
    cout << "A::f(), " << mi << endl;
  }
protected:
  int mi;
};

class B : public A
{
public:
  B(int i, int j) : A(i), mj(j) {}
  void f() override
  {
    cout << "B::f(), " << mi << ", " << mj << endl;
  }
private:
  int mj;
};

int main()
{
  A a1(1);
  B b(3,4);

  A& ra = b;
  ra.f();
  ra = a1;
  ra.f();

  A a2 = b;
  a2.f();
}

hw5.5

Snipaste_2024-06-03_01-05-45

hw6.5

Snipaste_2024-06-28_08-26-13


诚信守则

F:11、15、20、21、30、31、34、56

a02

a03

a04

a05

a06

a07

results matching ""

    No results matching ""