-3
(일부 변경 사항을 다시 게시하고 있습니다.) 단어의 모든 문자 (텍스트 파일에서 173528)를 소문자에서 대문자로 변환하는 프로그램을 만듭니다. 내 프로그램은 다음과 같습니다C에서 대문자로 소문자로 변환
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define NWORDS 173528
typedef char String[29];
void
Cap(char *Words[])
{
int i = 0;
while (Words[i] != '\0') {
Words[i] = Words[i] - 32;
i++;
}
}
void
Initialize(char *Words[])
{
int i;
String word;
char *pch;
for (i = 0; i < NWORDS; i++) {
scanf("%s", word);
pch = malloc(sizeof(char) * (strlen(word) + 1));
if (pch == NULL) {
printf("Memory is no enough\n");
exit(1);
}
strcpy(pch, word);
Words[i] = pch;
}
}
void
Print(char *Words[])
{
}
void
Free(char *Words[])
{
}
int
main()
{
char *Words[NWORDS];
Initialize(Words);
Cap(Words);
Print(Words);
Free(Words);
return 0;
}
예상 출력은 표시되지 않습니다. 당신의 도움에 미리 감사드립니다!
주를 사용해야합니다 : 당신은'Print' 할 것으로 예상된다 무엇 ctype.h –
에서의 ToUpper 및 tolower를 기능에서 살펴 봐야 할 수 있습니다? – jimifiki
모든 단어를 대문자로 인쇄하십시오. – Erail