2018년 4월 25일 수요일

C언어 컴퓨터개론실습

C언어 컴퓨터개론실습
C언어 컴퓨터개론실습.hwp


본문
아래 문장을 (a) 한 줄에, (b) 일곱 줄에, (c) 박스 안에 출력하는 프로그램으로 각각
작성하라.

she sells sea shells by the seashore

(a) 한줄에 작성

Source
#include <stdio.h>

int main(void)

printf( she sells sea shells by the seashore\n );
return 0;


Build output
e-class에 올라온 샘플처럼 영어로 뜨지 않고 아래와 같은 형식으로 빌드 결과가 나와서 캡처하였습니다.




Discussion
printf 함수를 이용하여 원하는 문장을 출력할 수 있다.

Execution result




(b) 일곱 줄에 작성

Source
#include <stdio.h>

int main(void)

printf( she\nsells\nsea\nshells\nby\nthe\nseashore\n );
return 0;


Build output




Discussion
\n을 7번 사용하여 1번에서 한줄에 출력한 문장을 7줄에 걸쳐 출력하였다.

Execution result



(c) 박스안에 작성
Source
#include <stdio.h>

int main(void)

printf( ┌──────────────────┐\n );
printf( │she sells sea shells by the seashore│\n );
printf( └──────────────────┘\n );
return 0;



Discussion
박스모양으로 선을 작성하여 출력된 문장이 박스안에 있게 출력되었다.

Build output




Execution result




하고 싶은 말
레포트자료입니다 많은 이용 부탁드립니다

키워드
문장, 함수, 주석, 프로그램, 번째, 출력

댓글 없음:

댓글 쓰기