본문 바로가기

전체 글6

Programming: Principles and Practice Using C++ Chapter 2 Hello, World! 영어 관련 정리 much as : ~이긴 하지만 ex. Much as I would like to stay, I really must go home. delimit - determine the limits of boundaries of nuisance - a person, thing, or circumstance causing inconvenicence of annoyance most likely to : 가장 ~ 할거 같은 ex. The person most likely to benefit from the comments in your code is you. make sense : 타당하다. ex. it makes sense to consider the hum.. 2020. 9. 15.
[Ch.05] 홍정모의 따라하며 배우는 C++ < 흐름제어> CH.05 흐름제어 5.1 제어 흐름 개요(Control flow) 5.2 조건문 if #include using namespace std; int min(int x, int y) { if (x > y) return y; else return x; /* if (x > y)return y; elsereturn x; */ // return (x > y) ? y : x; } int main() { int x; cin >> x; if (x > 10) { cout 2020. 9. 9.
[Ch.04] 홍정모의 따라하며 배우는 C++ < 변수 범위와 더 다양한 변수형> CH.04 연산자들변수 범위와 더 다양한 변수형 4.1 지역 변수의 범위(Scope)와 지속기간(Duration) #include //이름이 같은건 한 영역에 하나만 존재 가능. 만약 한 영역에서 사용하고 싶으면 namespace로 구분을 해줘야 됨. //아래처럼 namespace안에 namespace를 계속 추가 할 수 있다. 하지만 굉장히 보기 안좋다. //그래서 C++ 17에 추가된 기능이 있다. (컴파일러 버젼을 C++ 17로 변경해야 됨.) //하지만 기능이 좋아졌다고 해도 너무 추가해서 쓰면 안좋다. 한 2개 정도까지가 적당. /*namespace work1 { namespace work11 { namespace work11 { int a = 1; void doSomething() { a +=.. 2020. 9. 8.
[Ch.03] 홍정모의 따라하며 배우는 C++ < 연산자들> CH.03 연산자들 3.1 연산자 우선순위와 결합 법칙(Operator Precedence and Associativity) #include #include using namespace std; int main() { // 우선 순위가 같은 연산자들은 Left-to-right or Right-to-left 중에 알맞은 걸로 작동함. int x = 3 * 4 / 2; int y = std::pow(2, 3); //2의 3승 cout 2020. 9. 6.