c++ vector와 matrix class 구현

  • 등록일 / 수정일
  • 페이지 / 형식
  • 자료평가
  • 구매가격
  • 2010.09.12 / 2019.12.24
  • 10페이지 / fileicon zip (압축파일)
  • 평가한 분이 없습니다. (구매금액의 3%지급)
  • 1,900원
다운로드장바구니
Naver Naver로그인 Kakao Kakao로그인
c++ vector와 matrix class 구현
본문내용
c++의 기본을 다질 수 있는 vector와 matrix 클래스를 구현해 놓은 것입니다.
vector와 matrix를 클래스로 구현해 놓았고, main()함수에서 간단한 예제로
matrix m1, m2를 입력 받아서 매트릭스의 곱을 구하는 예제를 구현해 놓았습니다.
m1을 2 by 3 size 로 입력하고, m2를 3 by 2 size로 입력해서 각각 성분을 입력하면 그 곱을 구하는 예제입니다.
물론 예제는 사용자가 얼마든지 응용할 수 있겠죠, 중요한 건 vector와 matrix를 class로 잘 구현해 놓았다는 거죠.
잘 동작되는지는 충분히 검증해봤고, 연산이 안되는 숫자를 입력할 경우 error함수로 뭐가 잘 못 되었는지 출력되도록 작성되었습니다.
한마디로 공학용 class의 교과서라고 생각하심 될 듯 합니다.
visual c++에서 작성되었는데, 다른 compiler에서도 안 될 이유는 없으리라 생각됩니다.
main.cpp, vecmat.h, standard.h 이렇게 구성되어 있으며 zip 파일로 압축해놓았습니다.
잘 활용하세요.

*********************************************************
[프로그램 실행예]
Enter matrix m1 size, i by j

2
3
Enter matrix m2 size, i by j
3
2

enter 2 row vectors

enter row vector, 0
enter 3 elements:
[0] = 1.2
[1] = 2.2
[2] = 3
enter row vector, 1
enter 3 elements:
[0] = -2
[1] = 0.5
[2] = 4

enter 3 row vectors

enter row vector, 0
enter 2 elements:
[0] = 2
[1] = 1
enter row vector, 1
enter 2 elements:
[0] = 4.2
[1] = -2.2
enter row vector, 2
enter 2 elements:
[0] = 5
[1] = 3.8

m1 x m2 is
11.64 -3.64
-1.9 -3.1

*********************************************************
[프로그램 소스 일부]
class matrix {
friend vector;
private:
int numrows;
int numcols;
vector **mat;
int range(int);
public:
matrix(int, int);
matrix(int);
matrix(const matrix&);
~matrix();
vector& operator[] (int i);
matrix& operator+();
matrix& operator=(const matrix&);
matrix& operator+=(const matrix&);
matrix& operator-=(const matrix&);
matrix& operator*=(double);
matrix& operator/=(double);
int getnumrows();
int getnumcols();
자료평가
    아직 평가한 내용이 없습니다.
회원 추천자료
  • [컴공] C PROGRAMMING 교양강의노트
  • class.We can initialize k, but thereafter k cannot be assigned to, incremented, or decremented.A const cannot be used to specify an array sizecont int n = 3;int vn;A const should not be assigned the address of a const-qualified variable.const int a = 7;int *p = &a;volatileA volatile can be modified in some unspecified way by the hardware.extern const volatile int readtimeclock;7. Bitwise Operators and Enumeration TypesBitwise operatorspacking and unpacking dataenumeration types7.1 Bitwise Operators and Expressionsthe rules of precedence and associativity(pp.294)Bitwise Co

  • [컴공]네트웍과 NT에 관한 자료입니다.
  • classes A, B, or C, it is identified by the network part of theIP-addresses. However, the network part is now extended to includesome bits from the host part. The number of bits that are interpretedas the subnet number is given by the so-called subnet mask, ornetmask. This is a 32-bit number, too, which specifies the bitmask for the network part of the IP-address.Figure: Subnetting a class B networkThe campus network of Groucho Marx University is an example of such anetwork. It has a class-B network number of 149.76.0.0, and itsnetmask is therefore 255.255.0.0.Internally, GMUs cam

  • C언어 확실히 따라잡기
  • c++)fputc(c, fp1);fclose(fp1); /* 데이타 A 부터 Z 까지 write */ fp1 = fopen(atoz.xxx, r);fp2 = fopen(temp.xxx, w);for (i=1 ; ! feof(fp1) ; i++) printf(\n%s, fgets(s, i, fp1) ); /*

  • [졸업작품/졸업논문] [데이터 분석 프로그램] 자바(Java), 오라클(oracle), R을 연동한 프로그램
  • classFILE:PublicData/bin/PublicData/Connect.classFILE:PublicData/bin/PublicData/Disconnect.classFILE:PublicData/bin/PublicData/Help.classFILE:PublicData/bin/PublicData/InsertCSVAction.classFILE:PublicData/bin/PublicData/InsertCSVForm$1.classFILE:PublicData/bin/PublicData/InsertCSVForm$2.classFILE:PublicData/bin/PublicData/InsertCSVForm$3.classFILE:PublicData/bin/PublicData/InsertCSVForm$4.classFILE:PublicData/bin/PublicData/InsertCSVForm.classFILE:PublicData/bin/PublicData/InsertUser$1.classFILE:PublicData/bin/PublicData/InsertUser$2.classFILE:PublicData/bi

  • [컴퓨터공학과] 운영체제솔루션
  • class Fortunes static String fortunes = Ink: A villainous compound of tannogallate of iron, gum-arabic,\n+and water, chiefly used to facilitate the infection of idiocy and\n+promote intellectual crime.,Kleptomaniac: A rich thief,Mad: Affected with a high degree of intellectual independence.,Misfortune: The kind of fortune that never misses.,Monday: In Christian countries, the day after the baseball game.,The most powerful force in the world is that of a frisbee\n+straining to land under a car, just out of reach.,Hofstadters Law: It always takes longer than

오늘 본 자료 더보기
  • 오늘 본 자료가 없습니다.
  • 저작권 관련 사항 정보 및 게시물 내용의 진실성에 대하여 레포트샵은 보증하지 아니하며, 해당 정보 및 게시물의 저작권과 기타 법적 책임은 자료 등록자에게 있습니다. 위 정보 및 게시물 내용의 불법적 이용, 무단 전재·배포는 금지됩니다. 저작권침해, 명예훼손 등 분쟁요소 발견시 고객센터에 신고해 주시기 바랍니다.
    사업자등록번호 220-06-55095 대표.신현웅 주소.서울시 서초구 방배로10길 18, 402호 대표전화.02-539-9392
    개인정보책임자.박정아 통신판매업신고번호 제2017-서울서초-1806호 이메일 help@reportshop.co.kr
    copyright (c) 2003 reoprtshop. steel All reserved.