일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
- C++
- java
- Project
- 모의 주식
- 코딩테스트
- Reflex
- 사물인터넷
- 코딩
- 프로그램
- Python
- java정리
- frontend
- 풀스택프레임워크
- SNS
- 이웃한 칸
- 백준
- 코테
- 프로그래머스
- 주가예측
- 자바독학
- 개발
- 코딩독학
- 개인프로젝트
- 개발자
- backend
- 빅데이터
- 프로그래밍
- 코스닥
- 자바
- 자바정리
- Today
- Total
목록C++ Programming (41)
Creative Code
※main.cpp파일 #include #include "empty.h" int main() { Empty e1; //컴파일러에서 디폴트 생성자와 소멸자가 자동으로 생성)(명시적인 생성자가 없을때 생성) const Empty e2 = e1; //컴파일러에서 복사생성자를 자동으로 생성 e1 = e2; Empty *p1 = &e1; // e1.operator&() const Empty *p2 = &e2; // e2.operator&() return 0; } ※empty.h파일 #ifndef EMPTY_H #define EMPTY_H // 따로 만들지 않아도 컴파일러에서 자동으로 만들어주는 멤버함수 class Empty { //Empty() { }; //클래스 안에서 함수를 정의할 수 있다 (inline 함수로..
※main.cpp파일 #include #include "string.h" int main() { String s1; String s2 = "hello, world"; // String s2("hello,world"); //String s2 = 0;// NULL String s3 = s2; // String s3(s2); s1 = s2; String s4 = " IoT"; s1 = s2 + s4; s1 = "hello, "; //String tmp("hello, "); if (s1 == s2) std::cout
※main.cpp파일 #include #include "string.h" int main() { String s1; String s2 = "hello, world"; // String s2("hello, world"); String s3 = s2; // String s3(s2); String s4 = "aaa"; String s5 = "bbb"; s1 = s2; if (s1 == s2) { std::cout
※main.cpp파일 #include #include "rational.h" int main() { Rational r1; // 0 Rational r2(3); // 3/1 Rational r3(3,4); // 3/4 std::cout den * rhs.num; int den1 = this->den * rhs.den; int gcd = GCD(num1,den1); return Rational(num1/gcd,den1/gcd); } Rational Rational::operator-(const Rational &rhs) { int num1 = this->num * rhs.den - this->den * rhs.num; int den1 = this->den * rhs.den; int gcd = GCD(num..
※main.cpp파일 #include #include "complex.h" int main(){ Complex c1; //0.0 + 0.0i //Complex c2(3.0);//3.0 + 0.0i Complex c2 = 3.0; Complex c3(3.0,4.0);//3.0 + 4.0i Complex c4 = c3; //Complex c4; // default constructor //c4 = c3; // assignment //c1.real(c3.real()); //c1.imag(c3.imag()); c1 = c3; c1 +=c2; c1 >c2; c1 != c2; if (c1 == c3){ std::cout operator==(rhs); //return (this->re != rhs.re || this..
※main.cpp파일 #include #include "rational.h" int main(){ Rational r1(3,4); Rational r2(3); Rational r3; r3 = r1; if (r1 == r3) { std::cout den * rhs.den); result.num = (this->num * rhs.den - rhs.num * this->den)/gcd; result.den = (this->den * rhs.den)/gcd; return result; } Rational Rational::operator*(const Rational &rhs) { Rational result(this->num * rhs.num,this->den * rhs.den); int gcd = GCD(th..