#include <stdio.h> int main () { char arr[500]; int cnt = 0; int i = 0; printf("give your sentence : "); scanf("%[^\n]", arr); while (arr[i]!='\0') { if (arr[i]==' ') cnt++; i++; } printf("words : %d\n", cnt+1); }
'Programming > C' 카테고리의 다른 글
VSCode mac C++ 디버깅 (0) | 2019.08.19 |
---|---|
단어 수 세기 프로그램 (1) | 2014.11.12 |
scanf %s로 공백까지 입력받는 방법 (0) | 2014.11.03 |
Selection Sort (0) | 2014.10.23 |
동적할당 (Dynamic allocation) (0) | 2014.09.25 |
메모리 구조 (0) | 2014.09.25 |
댓글을 달아 주세요
wooritranss 2020.11.18 13:38 댓글주소 수정/삭제 댓글쓰기
유용한 내용 정말 잘 배우고 가용~