SlideShare a Scribd company logo
C++ !
http://blog.naver.com/ruvendix
Hello C++ World
#include <iostream>
using namespace std;
int main(void)
{
cout << “Hello C++ World” << endl;
return 0;
}
C++ 표준 입출력 헤더 파일
C++은 이렇게 출력한다!
http://blog.naver.com/ruvendix
cout과 cin
#include <iostream>
using namespace std;
int main(void)
{
cout << “Hello C++ World” << endl;
int iNum; // C++은 변수 중간 선언 가능
cin >> iNum;
cout << iNum;
return 0;
}
cout은 <<으로 출력
cin은 >>으로 입력
http://blog.naver.com/ruvendix
namespace
C++에는 식별자끼리 구분할 수 있는
namespace라는 게 있다!
using은 namespace의 보조 예약어!
using std::iNum => 그냥 iNum만 써도 됨
namespace std
{
int iNum;
}
std::iNum; // 이렇게 사용
using namespace std; // std를 사용하겠다!
http://blog.naver.com/ruvendix
새로운 자료형 bool
C++에는 참과 거짓을 판단하는 자료형이 있다!
그 자료형의 이름은 bool!
bool은 참을 의미하는 true와
거짓을 의미하는 false 예약어를 이용!
bool bButtonClick = false;
if (버튼 클릭함?)
{
bButtonClick = true;
}
http://blog.naver.com/ruvendix
함수 오버로딩
C++은 매개변수의 형식과 개수로
함수를 구분할 수 있다!
Show라는 식별자는 같지만 전부 다 다른 함수!
void Show(void);
void Show(int iNum);
void Show(int *pNum);
void Show(double dNum);
Show();
Show(10);
Show(&iAge);
Show(10.26);
http://blog.naver.com/ruvendix
기본 인자
C++에는 오른쪽 매개변수부터
기본 인자를 설정할 수 있다!
기본 인자는 오버로딩에 영향을 줄 수 있음!
void CheckButton(int iNum, bool bCheck = false)
{
if (bCheck == true)
{
cout << “버튼 클릭!n”; // 이렇게도 가능
}
}
http://blog.naver.com/ruvendix
참조자
C++에는 변수의 별명을 지정하는
참조자라는 게 있다!
참조자는 포인터와 비슷하지만
포인터보다 직관적임!
int iNum = 100;
int &rNum = iNum; // 참조자는 무조건 초기화!
void Show(int &rNum); // 참조자의 정보를 복사!
http://blog.naver.com/ruvendix
동적할당 연산자 new와 delete
C++에는 동적할당 연산자인
new와 delete가 있다!
어떻게 보면 malloc()과 free()와 비슷하지만
new와 delete는 함수가 아니라 연산자!
int *pNum = new int; // int 1개 할당
int *pNumList = new int[10] // int 10개 할당
delete pNum; // 단위 공간 해제
delete[] pNumList; // 연속 공간 해제
http://blog.naver.com/ruvendix
구조체의 확장
C++의 구조체는 함수를 가질 수 있다!
그리고 구조체 변수를 선언할 때 struct를 생략할 수 있다!
struct StudentInfo
{
char Name[20];
ShowInfo(void)
{
cout << Name << endl;
}
}
StudentInfo Student = {“박미송”};
Student.ShowInfo();
http://blog.naver.com/ruvendix

More Related Content

PDF
Hello world
PDF
Google coding guide
PDF
클래스의 추가 지식
PDF
연산자 오버로딩
PDF
전처리기
PPTX
100511 boost&tips 최성기
PDF
여러 생성자
PDF
상속과 다형성
Hello world
Google coding guide
클래스의 추가 지식
연산자 오버로딩
전처리기
100511 boost&tips 최성기
여러 생성자
상속과 다형성

What's hot (20)

PDF
[2007 CodeEngn Conference 01] 김기오 - NASM 어셈블러 사용법과 Calling Convention
PDF
[2008 CodeEngn Conference 02] seaofglass - Immunity Debugger 활용과 플러그인 제작
PDF
Geveloper 160816
PPTX
WTL 소개
KEY
Mongodb tip42 50
PDF
예외 처리
PDF
Start groovy
PPTX
C#을 사용한 빠른 툴 개발
PDF
Modern C++ 프로그래머를 위한 CPP11/14 핵심
PDF
[Td 2015]녹슨 c++ 코드에 모던 c++로 기름칠하기(옥찬호)
PDF
1.Startup JavaScript - 프로그래밍 기초
PDF
3 1. preprocessor, math, stdlib
PPTX
Refelction의 개념과 RTTR 라이브러리
PDF
함수
PPTX
[KGC 2011]Boost 라이브러리와 C++11
PPTX
Startup JavaScript 8 - NPM, Express.JS
PDF
Boost 라이브리와 C++11
PPTX
파이썬 스터디 9장
PDF
7급 공무원도 쉽게 따라하는 쉘 스크립트
PPTX
C++11
[2007 CodeEngn Conference 01] 김기오 - NASM 어셈블러 사용법과 Calling Convention
[2008 CodeEngn Conference 02] seaofglass - Immunity Debugger 활용과 플러그인 제작
Geveloper 160816
WTL 소개
Mongodb tip42 50
예외 처리
Start groovy
C#을 사용한 빠른 툴 개발
Modern C++ 프로그래머를 위한 CPP11/14 핵심
[Td 2015]녹슨 c++ 코드에 모던 c++로 기름칠하기(옥찬호)
1.Startup JavaScript - 프로그래밍 기초
3 1. preprocessor, math, stdlib
Refelction의 개념과 RTTR 라이브러리
함수
[KGC 2011]Boost 라이브러리와 C++11
Startup JavaScript 8 - NPM, Express.JS
Boost 라이브리와 C++11
파이썬 스터디 9장
7급 공무원도 쉽게 따라하는 쉘 스크립트
C++11
Ad

Viewers also liked (12)

PDF
형식 선정
PDF
클래스의 기초 지식
PDF
동적할당
PPTX
ELLEN JACOB - Substitutes
PPTX
Administrative Law
PDF
배열
PDF
템플릿
PPT
Sample Asset
PDF
포인터
PPTX
Presentation on Case of “McDonald’s Corporation’s British Pound Exposure”
PDF
구조체
PPTX
A subjetividade dos planos na composição da imagem & Fotografia para document...
형식 선정
클래스의 기초 지식
동적할당
ELLEN JACOB - Substitutes
Administrative Law
배열
템플릿
Sample Asset
포인터
Presentation on Case of “McDonald’s Corporation’s British Pound Exposure”
구조체
A subjetividade dos planos na composição da imagem & Fotografia para document...
Ad

Similar to Hello c++ world (20)

PDF
2013 C++ Study For Students #1
PPTX
Effective C++ Chaper 1
PPTX
PS에 쓸 수 있도록 C++ 입문하기.pptx ㅔ뱆더게ㅠㅐㅓㅔㅂ대ㅓ규ㅔㅐㅓ
PDF
HI-ARC PS 101
PDF
학교에서 배우지 않는 C
PDF
[C++ Korea 2nd Seminar] C++17 Key Features Summary
PDF
3주차 스터디
PDF
C++ Advanced 강의 5주차
PPTX
Effective cpp
PDF
2016 C++스터디 1주차
PDF
Api design for c++ 6장
PPTX
C++ 개요와 표준안
PDF
표준 입출력
PPTX
Effective c++ Chapter1,2
PPTX
Google c++codingconvention
PPTX
Ch.14 파일 강c v0.6
PPTX
Ec++ c 1,2 surmary
PPTX
C review
PPTX
C++11
PPTX
불어오는 변화의 바람, From c++98 to c++11, 14
2013 C++ Study For Students #1
Effective C++ Chaper 1
PS에 쓸 수 있도록 C++ 입문하기.pptx ㅔ뱆더게ㅠㅐㅓㅔㅂ대ㅓ규ㅔㅐㅓ
HI-ARC PS 101
학교에서 배우지 않는 C
[C++ Korea 2nd Seminar] C++17 Key Features Summary
3주차 스터디
C++ Advanced 강의 5주차
Effective cpp
2016 C++스터디 1주차
Api design for c++ 6장
C++ 개요와 표준안
표준 입출력
Effective c++ Chapter1,2
Google c++codingconvention
Ch.14 파일 강c v0.6
Ec++ c 1,2 surmary
C review
C++11
불어오는 변화의 바람, From c++98 to c++11, 14

Hello c++ world