谢谢版主.
#include "stdio.h"
int main (void)
{
char str;
FILE *fp;
if ((fp = fopen ("test.txt", "w")) == NULL)
{
printf (" can't create TXT file \n");
exit (0);
}
//str = getchar (); //在这个程式中终于搞清楚这两个和while loop中的str = getchar ();作用.
str = getchar ();
while ( str != '!')
{
if (str >= 'a' && str <= 'z')
str = str -32;
fputc (str, fp);
putchar (str);
str = getchar ();
}
fclose (fp);
getch ();
return 0;
}
[此贴子已经被作者于2006-5-13 9:02:17编辑过]