건국대학교 객체지향프로그래밍_10주차_랩실습보고서
- 최초 등록일
- 2023.02.21
- 최종 저작일
- 2021.05
- 9페이지/
MS 워드
- 가격 1,000원
![할인쿠폰받기](/images/v4/document/ico_det_coupon.gif)
소개글
건국대학교 컴퓨터공학부 객체지향 프로그래밍 수업의 랩실습 솔루션입니다.
자료 첫 페이지의 목차를 살펴보시고 구매자님께서 필요하신 랩실습이 맞으신지 확인하신 후 구매하시면 도움이 될 것 같습니다.
자료의 구성은 목차에 소개된 랩 실습의 코드와 실행결과로 구성되어있습니다.
알고리즘은 정확하고 간결하며 코드는 clean하게 정리한 후 업로드 하였습니다.
코딩을 하시면서 막히는 부분을 해결하기 위한 아이디어를 얻기위해 자료를 참고하신다면 큰 도움이 되실것 같습니다.
저는 모든 과제에서 만점을 받았고, 최종적으로 A+ 학점을 받았습니다.
감사합니다.
목차
1. 실습 1. arraydatasmart
1) Arraydata.h 소스코드
2) Arraydata..cpp 소스코드
3) smartArraydata.h 소스코드
4) smartArraydata cpp 소스코드
5) Main 소스코드
6) 실행결과
본문내용
#include "ArrayData.h"
#include <memory>
#include <iostream>
using namespace std;
ArrayData::ArrayData() : ArrayData(0, 0)
{
data=nullptr;
}
ArrayData::ArrayData(const int& capacity, const int& used):capacity(capacity)
{
//data = make_unique<double[]>(capacity);
data = new double[this->capacity];
cout << "생성자" << endl;
}
ArrayData::ArrayData(const ArrayData& arr) //arr는 객체!
{
this->capacity = arr.capacity;
this->used = arr.used;
data = new double[this->capacity];
//this->data = make_unique<double[]>(this->capacity);
for (int i = 0; i < this->used; i++) {
data[i] = arr.data[i];
}
}
ArrayData::ArrayData(ArrayData&& arr) noexcept
{
this->capacity = arr.capacity;
this->used = arr.used;
this->data = move(arr.data);
}
ArrayData::~ArrayData()
{
if (data != nullptr) {
delete[] data;
} data = nullptr;
}
void ArrayData::addElement(const double& num)
{
if (!full())
data[used++] = num; //이런 코딩 너무 좋아
else
cout << "빈방이 없음\n";
}
참고 자료
없음