검색결과 리스트
글
728x90
2014. 03. 13 수업 및 과제
07. 반복실행을 명령하는 반복문
7.1 while
[예제]
#include <stdio.h>
int main()
{
int iCnt;
iCnt=0;
while(3>iCnt) /* 조건: (논리연산자)참/거짓으로 판단 */
{
printf("test\n");
++iCnt;
}
return 0;
}
[결과]
7.1.1 while 무한루프의 구성
while(1)
{
printf("무한 루프\n");
}
7.2 for문
[예문]
#include <stdio.h>
int main()
{
int iCnt;
for(iCnt=0;3>iCnt;++iCnt) /* for(초기식;조건식;증감식) */
{
printf("test\n"); /* 반복의 문장 */
}
return 0;
}
[결과]
'…™업무일지。' 카테고리의 다른 글
[smart]이재우-20140317 (0) | 2014.03.17 |
---|---|
[smart]이재우-20140314 (0) | 2014.03.14 |
[smart]이재우-20140312 (0) | 2014.03.12 |
[smart]이재우-20140311 (0) | 2014.03.11 |
[smart]이재우-20140310 (0) | 2014.03.10 |
RECENT COMMENT