1.4 입출력 스트림과의 첫만남 cin, cout, endl
cin(console in)
cout(console out)
endl(end line)
입출력 스트림을 사용하기 위해서는 아래 헤더를 추가해야 한다.
#include <iostream> //cout, cin, endl, ...
#include <cstdio> //printf
\t
tab, 자동 줄 맞춤(기능을 수행하는 키)
abc def
ab cdef
\n
줄바꿈
\a
오디오 출력
using namespace std; 를 사용하면 std :: 생략 가능
#include <iostream>
#include <cstdio>
int main()
{
using namespace std;
int x = 1;
cout << "before your input, x was" << x << endl;
cin >> x ;
cout << "your input is" << x << endl;
return 0;
}
Result
before your input, x was 1
5 < cin(사용자가 숫자 입력)
your input is 5
'programming > c++' 카테고리의 다른 글
1.5 실습 (0) | 2019.03.28 |
---|---|
2019.03.24 - 함수와의 첫 만남 (0) | 2019.03.25 |
2918.03.21 - 프로그램 구조, 주석, 변수 (0) | 2019.03.22 |
2019. 03. 21 - 0.개념 (0) | 2019.03.21 |
2019.03.19 (0) | 2019.03.19 |