전세계를
하나로 연결하는 정보통신과
제목
[2-S] 알고리즘, C++ 10주 강의자료와 과제
작성일
2019.11.28
작성자
최진영
[알고리즘] 수업시간에 진행한 무방향 가중치 그래프의 인접리스트 구현 프로그램을 제출하세요. [C++ 과제] 아래 프로그램을 완료하여 [실행결과]와 같이 나오도록 만드세요. #include [실행결과] [22, 7]
using namespace std;
class Point {
private:
int xpos, ypos;
public:
Point(int x = 0, int y = 0) : xpos(x), ypos(y) { }
void ShowPosition() const {
cout << '[' << xpos << ", " << ypos << ']' << endl;
}
};
int main(void) {
Point pos1(3, 4), pos2(4, 5);
pos1 = 2 + pos2 * 5;
pos1.ShowPosition(); pos2.ShowPosition();
return 0;
}
[4, 5]