-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