#include <iostream>
#include <string>
using namespace std;

class Circle
{
private:
    int radius;
    string name;
public:
    void setCircle(string name, int radius)
    { this->name = name; this->radius = radius; }
    double getArea()
    {
        return 3.14*3.14*radius;
    }
    string getName()
    {
        return name;
    }
};

class CircleManager
{
private:
    Circle *p;
    int size;
public:
    CircleManager(int size)
    {
        p = new Circle[size];
    }
    ~CircleManager()
    {
        delete[] p;
    }
    void searchByName()
    {
        string Name;
        cout << "검색하고자 하는 원의 이름 >> ";
        cin >> Name;
        int i;           
        for (i = 0; i < size; i++)
        {
            if (Name == (p + i)->getName())
                cout << Name << " 의 면적은 " << (p + i)->getArea();
            //여기서 Name이 Cirlce 클래스의 setCircle 함수 안에 있는 name과 같으면
            //Name 의 면적은 (p+i)->getArea()   -----> 이렇게 출력 하려하는데요 비교가 안되고 바로 넘어갑니다.
        }
    }
    void searchByArea()
    {
        cout << "최소 면적을 정수로 입력하세요 >> ";
        double Area; cin >> Area;
        cout << Area << "보다 큰 원을 검색합니다.";

        for (int i = 0; i < size; i++)
        {
            if ((p + i)->getArea() > Area)
                cout << (p + i)->getName() << "의 면적은 " << (p + i)->getArea() << ',';
        }
    }

};

int main()
{

    int count;
    int radius;
    string name;
    cout << "원의 개수 >> ";
    cin >> count;
    CircleManager CircleManager(count);
    Circle *Array = new Circle[count];


    for (int i = 0; i < count; i++)
    {
        cout << "원 " << i + 1 << "의 이름과 반지름 >> ";

        cin >> name; cin >> radius;                   
            Array[i].setCircle(name, radius);

    }
    int i;
    for (i = 0; i < count; i++)
        cout << (Array + i)->getName() << ' ' << (Array + i)->getArea() << endl; //이름과 넓이가 정상적으로 적용됐는지 확인(된듯)


    CircleManager.searchByName();
    CircleManager.searchByArea();
    CircleManager.~CircleManager();

    delete [] Array;

}


클래스 안 searchByName에서
if문 안에서 비교 후 조건이 맞으면 출력되고 안되면 다음 i로 넘어가도록 만들었는데

이대로 시작시키고

검색하고자하는 원의 이름에 이름을 입력하면


출력이 안되고 바로 다음 함수인 CircleManager.searchByArea();로 넘어가더라구여


그리고 searchByArea안의 if 문에서도 같은 현상이 일어나는것 같습니다.

어떻게 수정해야 할까요??