본문 바로가기
Computer Science/C++

C++ -2- 입출력 스트림과의 첫 만남

by Choi Seung Hyeok 2021. 4. 5.
#include <iostream> // cout, cin, endl, ....
#include <cstdio> // prinf

int main()
{
	using namespace std; //네임스페이스 std를 사용하면 std::를 생략할 수 있다
	int x = 1024;
	double pi = 3.141592;

	cout << "I love this lecture!\n"; //<< std::endl;
	cout << " x is " << x << " pi is " << pi << endl;

	cout << "abc" << "\t" << "def" << endl;
	cout << "ab" << "\t" << "cdef" << endl;

	cout << "\a";

	//prinf("I love this lecture!\n")



	return 0;
}

스트림 입출력을 사용해 문자열을 출력함.

 

-Knowledge

 

\t: 문자열 사이에 공백을 만들 수 있음. 

 

\a: 컴퓨터가 알림음을 내게 함.

 

댓글