목차
polynomial.cpp
polynomial.dsp
polynomial.dsw
polynomial.h
polynomial.opt
polynomial.plg
polynomial.sln
polynomial.suo
polynomial.vcproj
polynomial.vcproj.USER-COMPUTER.Administrator.user
polynomial.vcproj.도시발.홍.user
test.cpp
polynomial.dsp
polynomial.dsw
polynomial.h
polynomial.opt
polynomial.plg
polynomial.sln
polynomial.suo
polynomial.vcproj
polynomial.vcproj.USER-COMPUTER.Administrator.user
polynomial.vcproj.도시발.홍.user
test.cpp
본문내용
#include
#include "polynomial.h"
using namespace std;
#define MAX(a,b) ((a>b) ? a : b)
polynomial::polynomial()
{
m_exp = 0;
m_coef = NULL;
}
polynomial::~polynomial()
{
if (m_coef)
{
delete [] m_coef;
m_coef = NULL;
}
}
polynomial::polynomial(int _exp)
{
m_exp = _exp;
m_coef = new int[m_exp+1];
for (int i=0; i<=m_exp; i++)
*(m_coef + i) = 0;
}
polynomial::polynomial(const polynomial & rhs)
{
m_exp = rhs.m_exp;
m_coef = new int[m_exp+1];
for (int i=0; i<=m_exp; i++)
{
m_coef[i] = rhs.m_coef[i];
}
}
void polynomial::SetExp(int _exp)
{
m_exp = _exp;
m_coef = new int[m_exp+1];
for (int i=0; i<=m_exp; i++)
*(m_coef + i) = 0;
}
void polynomial::SetCoef(int * _coef)
{
for (int i=0; i<=m_exp; i++)
{
m_coef[i] = _coef[i];
}
}
int polynomial::GetExp()
{
return m_exp;
}
int * polynomial::GetCoef()
{
return m_coef;
}
polynomial & polynomial::operator = (const polynomial & rhs)
{
if (this != &rhs)
{
delete [] m_coef;
m_exp = rhs.m_exp;
m_coef = new int[m_exp+1];
for (int i=0; i<=m_exp; i++)
{
m_coef[i] = rhs.m_coef[i];
}
}
return *this;
}
#include "polynomial.h"
using namespace std;
#define MAX(a,b) ((a>b) ? a : b)
polynomial::polynomial()
{
m_exp = 0;
m_coef = NULL;
}
polynomial::~polynomial()
{
if (m_coef)
{
delete [] m_coef;
m_coef = NULL;
}
}
polynomial::polynomial(int _exp)
{
m_exp = _exp;
m_coef = new int[m_exp+1];
for (int i=0; i<=m_exp; i++)
*(m_coef + i) = 0;
}
polynomial::polynomial(const polynomial & rhs)
{
m_exp = rhs.m_exp;
m_coef = new int[m_exp+1];
for (int i=0; i<=m_exp; i++)
{
m_coef[i] = rhs.m_coef[i];
}
}
void polynomial::SetExp(int _exp)
{
m_exp = _exp;
m_coef = new int[m_exp+1];
for (int i=0; i<=m_exp; i++)
*(m_coef + i) = 0;
}
void polynomial::SetCoef(int * _coef)
{
for (int i=0; i<=m_exp; i++)
{
m_coef[i] = _coef[i];
}
}
int polynomial::GetExp()
{
return m_exp;
}
int * polynomial::GetCoef()
{
return m_coef;
}
polynomial & polynomial::operator = (const polynomial & rhs)
{
if (this != &rhs)
{
delete [] m_coef;
m_exp = rhs.m_exp;
m_coef = new int[m_exp+1];
for (int i=0; i<=m_exp; i++)
{
m_coef[i] = rhs.m_coef[i];
}
}
return *this;
}
키워드
추천자료
[자료구조] max heap
산업정책의 의의 및 분류와 유형
자바 자료구조 족보
자료구조의 링크드 리스트를 이용한 명함관리 프로그램
[자료구조] 연결리스트 이용한 자료(노드) 삽입, 삭제
[자료구조, Algorithm] 외부정렬(External Sort) PPT version
[한국경제의이해]1960년대의 농업정책에 관해 논하시오
c로 쓴 자료구조론 연습문제 7장(정렬sorting)
자료구조 하노이탑 소스
[외부공간디자인] 예술의 전당 광장
[외부공간디자인] 예술의 전당 Seoul Art Center
자료구조, 리스트
자료구조, 큐
자료구조 - stack과 queue {소스코드, 함수, 출력결과}