⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_45880.htm

📁 vc
💻 HTM
字号:
<p>
序号:45880 发表者:江小刚 发表日期:2003-07-04 15:36:09
<br>主题:有关函数的问题!
<br>内容:程序:<BR>main()<BR>{char str[80];<BR> void insert(char str[]);<BR> printf("\nInput four digits:");<BR> scanf("%s",str);<BR> insert(str);<BR>}<BR>void insert(char str[])<BR>{<BR> int i;<BR> for(i=strlen(str);i&gt;0;i--)<BR>{<BR>&nbsp;&nbsp;str[2*i]=str[i];<BR>&nbsp;&nbsp;str[2*i-1]='';<BR> }<BR> printf("\nOutput:\n%s", str);<BR>}<BR><BR>该题目的意思是:输入一4位数,要求输出此4数,且每两个数字间有一空格。如:输入1990,应该输出:“1 9 9 0”。上叙程序,我调试的结果是:1。不管输入哪四个数,得到的均是第一个数字。请专家指出该程序的毛病??等待!!!
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:风之文章 回复日期:2003-07-04 16:14:19
<br>内容:‘’中应当加一个空格<BR>str[2*i-1]=' ';
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:江小刚 回复日期:2003-07-04 16:30:22
<br>内容:我刚发现了这个问题,也是在调试一个程序的时候。还是你们经验丰富,一看就知道。谢谢!!!!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -