问答题 下列给定程序的功能是:读入一个英文文本行,将其中每个单词的第一个字母改成大写,然后输出此文本行(这里”单词”是指由空格隔开的字符串)。例如,若输入"I am a student to takethe examination",则应输出"I Am A Student To TakeThe Examination"。请改正程序中的错误,使程序能得出正确的结果。注意:部分源程序在文件MODI1.C中,不要改动main函数,不得增行或删行,也不得更改程序的结构!试题程序:1 #include<stdlib.h>2 #include<string.h>3 #include<conio.h>4 #include<ctype.h>5 #include<stdio.h>6 #include<string.h>7 /*********found*********/8 void upfst(char P)9 {10 int k=0;11 for(;*P;P++)12 if(k)13 {14 if(*P=='')15 k=0;16 }17 else18 {19 if(*P!='')20 {21 k=1;22 *P=toupper(*P);23 }24 }25 }26 void main()27 {28 char chrstr[81]j29 System("CLS");30 printf("\nPlease enter an English text;lihe:");31 gets(chrstr);32 printf("\nBofore changing:\n%s",chrstr);33 upfst(chrstr);34 printf("\nAfter changing:\n%s\n",chrstr);35 }
【正确答案】正确答案:void upfst(char*p)
【答案解析】解析:主函数中fun函数的调用方式说明函数fun的参数应为指针类型。