﻿<?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++博客-linxuex</title><link>http://www.cppblog.com/linxuex/</link><description>C++学习者</description><language>zh-cn</language><lastBuildDate>Sun, 19 Apr 2026 10:30:37 GMT</lastBuildDate><pubDate>Sun, 19 Apr 2026 10:30:37 GMT</pubDate><ttl>60</ttl><item><title>请  教</title><link>http://www.cppblog.com/linxuex/archive/2007/04/21/lin00.html</link><dc:creator>linxuex</dc:creator><author>linxuex</author><pubDate>Sat, 21 Apr 2007 01:14:00 GMT</pubDate><guid>http://www.cppblog.com/linxuex/archive/2007/04/21/lin00.html</guid><wfw:comment>http://www.cppblog.com/linxuex/comments/22451.html</wfw:comment><comments>http://www.cppblog.com/linxuex/archive/2007/04/21/lin00.html#Feedback</comments><slash:comments>13</slash:comments><wfw:commentRss>http://www.cppblog.com/linxuex/comments/commentRss/22451.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/linxuex/services/trackbacks/22451.html</trackback:ping><description><![CDATA[<p>编一个程序，用同一个函数名对n个数据进行从小到大排序，数据类型可以是整型，单精度型，双精度型。用重载函数实现<br>#include&lt;iostream&gt;<br>#include&lt;string&gt;<br>using namespace std;<br>int main()<br>{ long a[5]={10100, -123567, 1198783, -165654, 3456};<br>&nbsp; int b[5]={1,9,0,23,-45};<br>&nbsp; float c[5]={2.4,7.6,5.5,6.6,-2.3};<br>&nbsp; void sort(long []);<br>&nbsp; void sort(int []);<br>&nbsp; void sort(float []);<br>&nbsp; sort(a);<br>&nbsp; sort(b);<br>&nbsp; sort(c);<br>&nbsp; return 0;<br>}</p>
<p>void sort(long [])<br>{int i,j;<br>&nbsp;long t;<br>&nbsp;for(j=0;j&lt;5;j++)<br>&nbsp;&nbsp; for(i=0;i&lt;5-j;;j++)<br>&nbsp;&nbsp;&nbsp; if(a[i]&gt;a[i+1])<br>&nbsp;&nbsp;&nbsp; {t=a[i];a[i]=a[i+1];a[i+1]=t;}<br>&nbsp;cout&lt;&lt;"the sorted numbers:"&lt;&lt;endl;<br>&nbsp;for(i=0;i&lt;5;j++)<br>&nbsp; cout&lt;&lt;a[i]&lt;&lt;" ";<br>&nbsp;cout&lt;&lt;endl&lt;&lt;endl;<br>}</p>
<p>void sort(int [])<br>{int i,j,t;<br>&nbsp;for(j=0;j&lt;5;j++)<br>&nbsp;&nbsp; for(i=0;i&lt;5-j;;j++)<br>&nbsp;&nbsp;&nbsp; if(a[i]&gt;a[i+1])<br>&nbsp;&nbsp;&nbsp; {t=a[i];a[i]=a[i+1];a[i+1]=t;}<br>&nbsp;cout&lt;&lt;"the sorted numbers:"&lt;&lt;endl;<br>&nbsp;for(i=0;i&lt;5;j++)<br>&nbsp; cout&lt;&lt;a[i]&lt;&lt;" ";<br>&nbsp;cout&lt;&lt;endl&lt;&lt;endl;<br>}</p>
<p>void sort(float [])<br>{int i,j;<br>&nbsp;float t;<br>&nbsp;for(j=0;j&lt;5;j++)<br>&nbsp;&nbsp; for(i=0;i&lt;5-j;;j++)<br>&nbsp;&nbsp;&nbsp; if(a[i]&gt;a[i+1])<br>&nbsp;&nbsp;&nbsp; {t=a[i];a[i]=a[i+1];a[i+1]=t;}<br>&nbsp;cout&lt;&lt;"the sorted numbers:"&lt;&lt;endl;<br>&nbsp;for(i=0;i&lt;5;j++)<br>&nbsp; cout&lt;&lt;a[i]&lt;&lt;" ";<br>&nbsp;cout&lt;&lt;endl&lt;&lt;endl;<br>}</p>
<p>&nbsp;<br>&nbsp;//d:\c++6.0\vs63in1 (g)\vc60chs\vc98\include\ios(9) : fatal error C1083: Cannot open include file: 'streambuf.h': No such file or directory<br>Cpp1.obj - 1 error(s), 0 warning(s)&nbsp; 请问是什么原因?如何解决？<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C++初学习者<br></p>
<img src ="http://www.cppblog.com/linxuex/aggbug/22451.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/linxuex/" target="_blank">linxuex</a> 2007-04-21 09:14 <a href="http://www.cppblog.com/linxuex/archive/2007/04/21/lin00.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>