문자열로 문자를 입력받아 소문자를 대문자로 변경하는 프로그램
여러가지 방법이 있지만 toupper함수를 사용하여 쉽게 작성하였다
#include<stdio.h>
#include<ctype.h>
int main(void) {
char ch[80];
scanf_s("%s", ch, sizeof(ch));
for (int i = 0; ch[i]; i++) {
ch[i] = (char)toupper(ch[i]);
}
printf("%s", ch);
system("pause");
return 0;
}
'일일코딩 > c언어' 카테고리의 다른 글
c언어 : 홀수만 더하기 (0) | 2019.09.15 |
---|---|
c언어: 대각선 출력하기 (0) | 2019.09.14 |
c언어 : 최대값 구하기 (0) | 2019.09.13 |
c언어 : 평균값 구하기 (0) | 2019.09.12 |