1003 : [기초-출력] 출력하기03

윤형찬·2020년 10월 30일

코드업 기초 100제

목록 보기
3/8
post-thumbnail

문제

이번에는 줄을 바꿔 출력하는 출력문을 연습해보자.
다음과 같이 줄을 바꿔 출력해야 한다.

Hello
World

풀이

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello" << endl;
    cout << "World" << endl;
}

해법 2) cout << "Hello\nWorld << endl;

  • 이스케이프 문자
    - \n : new line, 줄을 바꿀 위치에 넣는다
    - \t : tab
    - \c : carriage return, 그 줄의 맨앞으로 커서를 보낸다.
profile
https://github.com/velmash

0개의 댓글