﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-liulei548534</title><link>http://www.cppblog.com/liulei548534/</link><description /><language>zh-cn</language><lastBuildDate>Tue, 07 Apr 2026 23:24:33 GMT</lastBuildDate><pubDate>Tue, 07 Apr 2026 23:24:33 GMT</pubDate><ttl>60</ttl><item><title>逆序输出不超过五位正整数</title><link>http://www.cppblog.com/liulei548534/archive/2012/09/09/190058.html</link><dc:creator>路易</dc:creator><author>路易</author><pubDate>Sun, 09 Sep 2012 15:31:00 GMT</pubDate><guid>http://www.cppblog.com/liulei548534/archive/2012/09/09/190058.html</guid><wfw:comment>http://www.cppblog.com/liulei548534/comments/190058.html</wfw:comment><comments>http://www.cppblog.com/liulei548534/archive/2012/09/09/190058.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/liulei548534/comments/commentRss/190058.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/liulei548534/services/trackbacks/190058.html</trackback:ping><description><![CDATA[<div><div>#include&lt;stdio.h&gt;</div><div>int main()</div><div>{</div><div><span style="white-space:pre">	</span>int n,a,b,c,d,e,num = 0;</div><div><span style="white-space:pre">	</span>int ret;</div><div><span style="white-space:pre">	</span>while(1)</div><div><span style="white-space:pre">	</span>{</div><div><span style="white-space:pre">		</span>printf("请输入不超过无五位的正整数:\n");</div><div><span style="white-space:pre">		</span>ret = scanf("%d",&amp;num);</div><div><span style="white-space:pre">		</span>fflush(stdin);</div><div><span style="white-space:pre">		</span>if(num&lt;0 || num&gt;100000)</div><div><span style="white-space:pre">		</span>{</div><div><span style="white-space:pre">			</span>printf("输入有误！");</div><div><span style="white-space:pre">			</span>continue;</div><div><span style="white-space:pre">		</span>}</div><div><span style="white-space:pre">		</span>if(ret ==1)break;</div><div><span style="white-space:pre">	</span>}</div><div><span style="white-space:pre">	</span>if(num&gt;10000) &nbsp; &nbsp; &nbsp; &nbsp;n = 5;</div><div><span style="white-space:pre">	</span>else if(num&gt;1000)<span style="white-space:pre">	</span> n = 4;</div><div><span style="white-space:pre">	</span>else if(num&gt;100)<span style="white-space:pre">	</span> n = 3;</div><div><span style="white-space:pre">	</span>else if(num&gt;10)<span style="white-space:pre">	</span> &nbsp; &nbsp; n = 2;</div><div><span style="white-space:pre">	</span>else if(num&gt;0)<span style="white-space:pre">	</span> &nbsp; &nbsp; n = 1;</div><div><span style="white-space:pre">	</span>a = num%10;</div><div><span style="white-space:pre">	</span>b = num/10%10;</div><div><span style="white-space:pre">	</span>c = num/100%10;</div><div><span style="white-space:pre">	</span>d = num/1000%10;</div><div><span style="white-space:pre">	</span>e = num/10000;</div><div><span style="white-space:pre">	</span>printf("这是个%d位数\n",n);</div><div><span style="white-space:pre">	</span>printf("这个原数为%d\n",num);</div><div><span style="white-space:pre">	</span>switch(n)</div><div><span style="white-space:pre">	</span>{</div><div><span style="white-space:pre">		</span>case 5:</div><div><span style="white-space:pre">			</span>printf("逆序输出为：%d,%d,%d,%d,%d\n",a,b,c,d,e);break;</div><div><span style="white-space:pre">		</span>case 4:</div><div><span style="white-space:pre">			</span>printf("逆序输出为：%d,%d,%d,%d\n",a,b,c,d);break;</div><div><span style="white-space:pre">		</span>case 3:</div><div><span style="white-space:pre">			</span>printf("逆序输出为：%d,%d,%d\n",a,b,c);break;</div><div><span style="white-space:pre">		</span>case 2:</div><div><span style="white-space:pre">			</span>printf("逆序输出为：%d,%d\n",a,b);break;</div><div><span style="white-space:pre">		</span>case 1:</div><div><span style="white-space:pre">			</span>printf("逆序输出为：%d\n",a);break;</div><div><span style="white-space:pre">	</span>}</div><div>}</div></div><img src ="http://www.cppblog.com/liulei548534/aggbug/190058.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/liulei548534/" target="_blank">路易</a> 2012-09-09 23:31 <a href="http://www.cppblog.com/liulei548534/archive/2012/09/09/190058.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>冒泡儿排序</title><link>http://www.cppblog.com/liulei548534/archive/2012/09/09/190057.html</link><dc:creator>路易</dc:creator><author>路易</author><pubDate>Sun, 09 Sep 2012 15:30:00 GMT</pubDate><guid>http://www.cppblog.com/liulei548534/archive/2012/09/09/190057.html</guid><wfw:comment>http://www.cppblog.com/liulei548534/comments/190057.html</wfw:comment><comments>http://www.cppblog.com/liulei548534/archive/2012/09/09/190057.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/liulei548534/comments/commentRss/190057.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/liulei548534/services/trackbacks/190057.html</trackback:ping><description><![CDATA[<div><div>#define N 4</div><div>#include&lt;stdio.h&gt;</div><div>int main(void)</div><div>{</div><div><span style="white-space:pre">	</span>int i,j;</div><div><span style="white-space:pre">	</span>int a[N],temp;</div><div><span style="white-space:pre">	</span>printf("请输入四个整数：\n");</div><div><span style="white-space:pre">	</span>for(i=0;i&lt;N;i++)</div><div><span style="white-space:pre">	</span>{</div><div><span style="white-space:pre">		</span>scanf("%d",&amp;a[i]);</div><div><span style="white-space:pre">	</span>}</div><div><span style="white-space:pre">	</span>for(i=1;i&lt;N;i++)</div><div><span style="white-space:pre">	</span>{</div><div><span style="white-space:pre">		</span>for(j=0;j&lt;N-i;j++)</div><div><span style="white-space:pre">		</span>{</div><div><span style="white-space:pre">			</span>if(a[j]&gt;a[j+1])</div><div><span style="white-space:pre">			</span>{</div><div><span style="white-space:pre">				</span>temp=a[j];</div><div><span style="white-space:pre">				</span>a[j]=a[j+1];</div><div><span style="white-space:pre">				</span>a[j+1]=temp;</div><div><span style="white-space:pre">			</span>}</div><div><span style="white-space:pre">		</span>}</div><div><span style="white-space:pre">	</span>}</div><div><span style="white-space:pre">	</span>printf("the result is:\n");</div><div><span style="white-space:pre">	</span>for(i=0;i&lt;N;i++)</div><div><span style="white-space:pre">		</span>printf("%d\t",a[i]);</div><div><span style="white-space:pre">	</span></div><div>}</div></div><img src ="http://www.cppblog.com/liulei548534/aggbug/190057.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/liulei548534/" target="_blank">路易</a> 2012-09-09 23:30 <a href="http://www.cppblog.com/liulei548534/archive/2012/09/09/190057.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>c笔记1</title><link>http://www.cppblog.com/liulei548534/archive/2012/08/27/188379.html</link><dc:creator>路易</dc:creator><author>路易</author><pubDate>Mon, 27 Aug 2012 00:57:00 GMT</pubDate><guid>http://www.cppblog.com/liulei548534/archive/2012/08/27/188379.html</guid><wfw:comment>http://www.cppblog.com/liulei548534/comments/188379.html</wfw:comment><comments>http://www.cppblog.com/liulei548534/archive/2012/08/27/188379.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/liulei548534/comments/commentRss/188379.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/liulei548534/services/trackbacks/188379.html</trackback:ping><description><![CDATA[<div><span style="font-family: 微软雅黑; font-size: 18px; line-height: normal; ">注意：在C语言中，关键字都是小写的。</span><div style="font-family: 微软雅黑; font-size: 18px; line-height: normal; "><br /><div>运算符丰富。共有34种。C把括号、赋值、逗号等都作为运算符处理。</div><div></div><div>C语言允许直接访问物理地址，能进行位（bit）操作，能实现汇编语言的大部分功能，可以直接对硬件进行操作。</div><div></div><div>凡是在程序中调用一个库函数时，都必须包含该函数原型所在的头文件。</div></div><div style="font-family: 微软雅黑; font-size: 18px; line-height: normal; "></div><div style="font-family: 微软雅黑; font-size: 18px; line-height: normal; ">程序=算法+数据结构+程序设计方法+语言工具环境<br />main()<br />{<br />int sign=1;<br />float deno=2.0,sum=1.0,trem;<br />while(deno&lt;=100)<br />&nbsp; {<br />&nbsp; &nbsp; &nbsp; sign=-sign;<br />&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;term=sign/deno;<br />&nbsp; &nbsp; &nbsp; sum=sum+term;<br />&nbsp; &nbsp; &nbsp; deno=deno+1;<br />&nbsp; }<br />&nbsp; &nbsp;printf("%f",sum);<br />}<br /></div><div style="font-family: 微软雅黑; font-size: 18px; line-height: normal; "><div><img src="file:///C:/Users/Administrator/AppData/Local/youdao/ynote/images/98574FE684ED4C2594495C82710D2386/clipboard.png" data-inited="true" data-media-type="image" style="cursor: default; display: inline-block; "  alt="" /></div></div><div style="font-family: 微软雅黑; font-size: 18px; line-height: normal; "><img src="file:///C:/Users/Administrator/AppData/Local/youdao/ynote/images/98574FE684ED4C2594495C82710D2386/clipboard.png" data-inited="true" data-media-type="image" style="cursor: default; display: inline-block; "  alt="" /></div><div style="font-family: 微软雅黑; font-size: 18px; line-height: normal; ">term中间变量设置得使sum更清晰，sigh=-sigh很巧妙解决了正负交替问题。</div><div style="font-family: 微软雅黑; font-size: 18px; line-height: normal; "></div><div style="font-family: 微软雅黑; font-size: 18px; line-height: normal; ">在C中，数据类型分为：基本数据类型，<strong>构造数据类型</strong>（包括数组，结构体，共用体类型）<strong>，指针类型，空类型</strong>&nbsp;四大类</div></div><img src ="http://www.cppblog.com/liulei548534/aggbug/188379.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/liulei548534/" target="_blank">路易</a> 2012-08-27 08:57 <a href="http://www.cppblog.com/liulei548534/archive/2012/08/27/188379.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>