<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://www.gentoo-zh.org/extern.php?action=feed&amp;tid=407&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Gentoo中文社区 / C 练习实例98]]></title>
		<link>https://www.gentoo-zh.org/viewtopic.php?id=407</link>
		<description><![CDATA[C 练习实例98 最近发表的帖子。]]></description>
		<lastBuildDate>Mon, 29 Aug 2022 11:57:37 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[C 练习实例98]]></title>
			<link>https://www.gentoo-zh.org/viewtopic.php?pid=413#p413</link>
			<description><![CDATA[<p>题目：从键盘输入一个字符串，将小写字母全部转换成大写字母，然后输出到一个磁盘文件&quot;test&quot;中保存。 输入的字符串以！结束。</p><p>程序分析：无。</p><p>程序源代码：</p><div class="codebox"><pre class="vscroll"><code>#include&lt;stdio.h&gt;
#include&lt;stdlib.h&gt;
#include&lt;string.h&gt;
 
int main()
{
    FILE*fp=NULL;
    char str[50];
    int i,len;
    printf(&quot;输入一个字符串：\n&quot;);
    gets(str);
    len=strlen(str);
    for(i=0;i&lt;len;i++)
    {
        if(str[i]&lt;=&#039;z&#039;&amp;&amp;str[i]&gt;=&#039;a&#039;)
            str[i]-=32;
    }
    if((fp=fopen(&quot;test&quot;,&quot;w&quot;))==NULL)
    {
        printf(&quot;error: cannot open file!\n&quot;);
        exit(0);
    }
    fprintf(fp,&quot;%s&quot;,str);
    fclose(fp);
    
    system(&quot;pause&quot;);
    return 0;
}</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (batsom)]]></author>
			<pubDate>Mon, 29 Aug 2022 11:57:37 +0000</pubDate>
			<guid>https://www.gentoo-zh.org/viewtopic.php?pid=413#p413</guid>
		</item>
	</channel>
</rss>
