给定程序MODI1.C中函数fun()的功能是:将p所指字符串中每个单词的最后一个字母改成大写(这里的“单词”是指由空格隔开的字符串)。 例如,若输入”I am a student to take the examination.”,则应输出”I aM A studenT tO takE thE examination.”。 请修改程序中的错误之处,使它能得出正确的结果。 注意:不要改动main()函数,不得删行,也不得更改程序的结构。 #include<ctype.h> #include<stdio.h> #include<string.h> void fun(char *p)
char chrstr[64]; int d; printf("\nPlease enter an English sentence within 63 letters:"); gets(chrstr); d=strlen(chrstr); chrstr[d]=’’; chrstr[d+1]=0; printf("\n\nBefore changing:\n %s",chrstr); fun(chrstr); printf("\nAfter changing:\n%s",chrstr);