??xml version="1.0" encoding="utf-8" standalone="yes"?>原创国产精品91,国产日韩亚洲欧美精品,国内精品国语自产拍在线观看http://m.shnenglu.com/shexinwei/~写人生的代?/description>zh-cnSun, 16 Nov 2025 06:35:20 GMTSun, 16 Nov 2025 06:35:20 GMT60字符串删除子?C++)http://m.shnenglu.com/shexinwei/archive/2010/10/06/128812.html马赛?07马赛?07Wed, 06 Oct 2010 12:45:00 GMThttp://m.shnenglu.com/shexinwei/archive/2010/10/06/128812.htmlhttp://m.shnenglu.com/shexinwei/comments/128812.htmlhttp://m.shnenglu.com/shexinwei/archive/2010/10/06/128812.html#Feedback0http://m.shnenglu.com/shexinwei/comments/commentRss/128812.htmlhttp://m.shnenglu.com/shexinwei/services/trackbacks/128812.html#include <iostream>
using namespace std;

int main()
{
    
char str[50= {0};
    
char subStr[10= {0};

    
//输入M?l尾
    cout<<"input the string:";
    
for(int i = 0;i<sizeof(str)/sizeof(str[0]);i++)
    {
        cin
>>str[i];
        
if(str[i] == '#')
        {
            str[i] 
= '\0';
            
break;
        }
    }

    
//输入子串?l尾
    cout<<"input the substring:";
    
for(int i = 0;i<sizeof(subStr)/sizeof(subStr[0]);i++)
    {
      cin
>>subStr[i];
      
if(subStr[i] == '#')
      {
          subStr[i] 
= '\0';
          
break;
      }
    }

    
//用于标记是否扑ֈ子串
    bool isSub = true;

    
//扑֭?/span>
    for(int i = 0;i<strlen(str);i++)
    {
        isSub 
= true;
        
for(int j = 0;j<strlen(subStr);j++)
        {
            
if(subStr[j] == str[i+j]) continue;
            
else 
            {
                isSub 
= false;
                
break;
            }

        }
        
        
if(isSub)
        {
//如果扑ֈ子串Q则后l字W全部前U?/span>
         for(int m = i;m<strlen(str)+1-strlen(subStr);m++)
         {
             str[m] 
= str[m+strlen(subStr)];
         }
        }
    }

    
//输出删除后的
    cout<<"the result string:"<<str<<endl;
    system(
"pause");
    
return 1;
}


马赛?07 2010-10-06 20:45 发表评论
]]>
冒排序(C++)http://m.shnenglu.com/shexinwei/archive/2010/09/28/127992.html马赛?07马赛?07Tue, 28 Sep 2010 13:46:00 GMThttp://m.shnenglu.com/shexinwei/archive/2010/09/28/127992.htmlhttp://m.shnenglu.com/shexinwei/comments/127992.htmlhttp://m.shnenglu.com/shexinwei/archive/2010/09/28/127992.html#Feedback0http://m.shnenglu.com/shexinwei/comments/commentRss/127992.htmlhttp://m.shnenglu.com/shexinwei/services/trackbacks/127992.html/*
Subject:      Bubble sort
Author:       shexinwei
Date:         2010-09-28
Laguage:      C++
IDE | Tool:   GCC(DEV 5.0)
Version:      1.0
Modify Time:  2010-09-28
*/   

#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
//排序函数
int Bublle_sort(int data[],int n);
//打印数组函数
int print(int data[],int n);
int main(int argc, char *argv[])
{
    int data[] = { 2,1,5,3,5,2,6,2};
    int length = sizeof(data)/sizeof(data[0]);
    cout<<"初始序列:"<<endl;
    print(data,length);
    Bublle_sort(data,length);
    cout<<"最l结?"<<endl;
    print(data,length);
    cout<<endl;
    system("pause");
    return 1;
}
int Bublle_sort(int data[],int n)
{
int tmp = 0;
for(int i = 0;i < n;i++)
{
    for(int j = 0;j < n-i-1;j++)
    {
            if(data[j]<data[j+1])
            {
               tmp = data[j];
               data[j] = data[j+1];
               data[j+1] = tmp;
            }
            else continue;
    }
    cout<<i+1<<"ơ排序结?"<<endl;
    print(data,n);
    cout<<endl;
}
    return 1;
}
int print(int data[],int n)
{
    for(int i = 0;i < n;i++)
    {
            cout<<data[i]<<" ";
    }
            cout<<endl;
}

调试l果Q?br>



马赛?07 2010-09-28 21:46 发表评论
]]>
q雷W试?C++)http://m.shnenglu.com/shexinwei/archive/2010/09/25/127675.html马赛?07马赛?07Sat, 25 Sep 2010 14:49:00 GMThttp://m.shnenglu.com/shexinwei/archive/2010/09/25/127675.htmlhttp://m.shnenglu.com/shexinwei/comments/127675.htmlhttp://m.shnenglu.com/shexinwei/archive/2010/09/25/127675.html#Feedback16http://m.shnenglu.com/shexinwei/comments/commentRss/127675.htmlhttp://m.shnenglu.com/shexinwei/services/trackbacks/127675.html 1/////////////////////////////////////////////////
 2//q雷W试题:
 3//有N个大不{的自然敎ͼ1--NQ,请将它们由小到大排序?nbsp;  
 4//要求E序法Q时间复杂度为O(n)Q空间复杂度为O(1)?/span>
 5
 6#define TEST_XUNLEI
 7
 8#ifdef TEST_XUNLEI
 9
10#include <iostream>
11using namespace std;
12int sort(int data[],int n);
13int main()
14{
15    int data[] = {8,7,9,4,6,5,3,2,1};
16    for(int i = 0 ;i < sizeof(data)/sizeof(int);i++)
17        cout<<data[i]<<" ";
18    cout<<endl;
19    sort(data,sizeof(data)/sizeof(int));
20    system("pause");
21    return 1;
22}

23int sort(int data[],int n)
24{
25    //保证I间复杂度ؓO(1)
26    int tmp = 0;               
27    for(int i = 0;i < n;i++)    
28    {
29       //UdQ直到第data[i]为i+1的时,whilel束循环。向后l判?/span>
30        while(data[i] != i+1)   
31        
32            //每次循环保证了data[i-1]的正。d有n个所以时间复杂度为O(N)
33            tmp = data[data[i]-1];
34            data[data[i]-1= data[i];        
35            data[i] = tmp;
36        }

37    }

38    for(int i = 0;i < n;i++)
39        cout<<data[i]<<" ";
40    cout<<endl;
41    return 1;
42}

43
44
45#endif 该题的重点在于,N?--N的数?

马赛?07 2010-09-25 22:49 发表评论
]]>
n个小于一百万可重复数的排?/title><link>http://m.shnenglu.com/shexinwei/archive/2010/09/20/127153.html</link><dc:creator>马赛?07</dc:creator><author>马赛?07</author><pubDate>Mon, 20 Sep 2010 09:33:00 GMT</pubDate><guid>http://m.shnenglu.com/shexinwei/archive/2010/09/20/127153.html</guid><wfw:comment>http://m.shnenglu.com/shexinwei/comments/127153.html</wfw:comment><comments>http://m.shnenglu.com/shexinwei/archive/2010/09/20/127153.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://m.shnenglu.com/shexinwei/comments/commentRss/127153.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/shexinwei/services/trackbacks/127153.html</trackback:ping><description><![CDATA[<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000"> RAND</span><span style="COLOR: #000000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000"> RANK</span><span style="COLOR: #000000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#ifdef RAND<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> std;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">time.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_102_112_Open_Image onclick="this.style.display='none'; Codehighlighter1_102_112_Open_Text.style.display='none'; Codehighlighter1_102_112_Closed_Image.style.display='inline'; Codehighlighter1_102_112_Closed_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_102_112_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_102_112_Closed_Text.style.display='none'; Codehighlighter1_102_112_Open_Image.style.display='inline'; Codehighlighter1_102_112_Open_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">enum</span><span id=Codehighlighter1_102_112_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_102_112_Open_Text><span style="COLOR: #000000">{MAX</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">10000</span><span style="COLOR: #000000">}</span></span><span style="COLOR: #000000">;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main()<br><img id=Codehighlighter1_126_324_Open_Image onclick="this.style.display='none'; Codehighlighter1_126_324_Open_Text.style.display='none'; Codehighlighter1_126_324_Closed_Image.style.display='inline'; Codehighlighter1_126_324_Closed_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_126_324_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_126_324_Closed_Text.style.display='none'; Codehighlighter1_126_324_Open_Image.style.display='inline'; Codehighlighter1_126_324_Open_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_126_324_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_126_324_Open_Text><span style="COLOR: #000000">{<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    ofstream </span><span style="COLOR: #0000ff">out</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">rand.txt</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">输出L</span><span style="COLOR: #008000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">out</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">MAX</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    <br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    srand((unsigned </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">)time(NULL));<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    <br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;i </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> MAX;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_249_272_Open_Image onclick="this.style.display='none'; Codehighlighter1_249_272_Open_Text.style.display='none'; Codehighlighter1_249_272_Closed_Image.style.display='inline'; Codehighlighter1_249_272_Closed_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_249_272_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_249_272_Closed_Text.style.display='none'; Codehighlighter1_249_272_Open_Image.style.display='inline'; Codehighlighter1_249_272_Open_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_249_272_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_249_272_Open_Text><span style="COLOR: #000000">{<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">out</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">rand()</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</span></span><span style="COLOR: #000000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">out</span><span style="COLOR: #000000">.close();<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    cout</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">out over</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">endl;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">#endif</span><span style="COLOR: #000000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#ifdef RANK<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> std;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main()<br><img id=Codehighlighter1_398_836_Open_Image onclick="this.style.display='none'; Codehighlighter1_398_836_Open_Text.style.display='none'; Codehighlighter1_398_836_Closed_Image.style.display='inline'; Codehighlighter1_398_836_Closed_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_398_836_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_398_836_Closed_Text.style.display='none'; Codehighlighter1_398_836_Open_Image.style.display='inline'; Codehighlighter1_398_836_Open_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_398_836_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_398_836_Open_Text><span style="COLOR: #000000">{<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> max </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    ifstream </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">rand.txt</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">获取要排序数的个?/span><span style="COLOR: #008000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">max;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">初始化统计数l?/span><span style="COLOR: #008000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">num </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">[RAND_MAX];<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;i </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> max;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_537_554_Open_Image onclick="this.style.display='none'; Codehighlighter1_537_554_Open_Text.style.display='none'; Codehighlighter1_537_554_Closed_Image.style.display='inline'; Codehighlighter1_537_554_Closed_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_537_554_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_537_554_Closed_Text.style.display='none'; Codehighlighter1_537_554_Open_Image.style.display='inline'; Codehighlighter1_537_554_Open_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_537_554_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_537_554_Open_Text><span style="COLOR: #000000">{<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        num[i] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</span></span><span style="COLOR: #000000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> tmp </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">d数据Qƈl计</span><span style="COLOR: #008000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;i </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> max;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_610_641_Open_Image onclick="this.style.display='none'; Codehighlighter1_610_641_Open_Text.style.display='none'; Codehighlighter1_610_641_Closed_Image.style.display='inline'; Codehighlighter1_610_641_Closed_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_610_641_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_610_641_Closed_Text.style.display='none'; Codehighlighter1_610_641_Open_Image.style.display='inline'; Codehighlighter1_610_641_Open_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_610_641_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_610_641_Open_Text><span style="COLOR: #000000">{<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">tmp;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        num[tmp] </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</span></span><span style="COLOR: #000000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">输出</span><span style="COLOR: #008000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">    ofstream </span><span style="COLOR: #0000ff">out</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">out.txt</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;i </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> max;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_702_798_Open_Image onclick="this.style.display='none'; Codehighlighter1_702_798_Open_Text.style.display='none'; Codehighlighter1_702_798_Closed_Image.style.display='inline'; Codehighlighter1_702_798_Closed_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_702_798_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_702_798_Closed_Text.style.display='none'; Codehighlighter1_702_798_Open_Image.style.display='inline'; Codehighlighter1_702_798_Open_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_702_798_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_702_798_Open_Text><span style="COLOR: #000000">{<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(num[i] </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> j </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;j </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> num[i];j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_759_795_Open_Image onclick="this.style.display='none'; Codehighlighter1_759_795_Open_Text.style.display='none'; Codehighlighter1_759_795_Closed_Image.style.display='inline'; Codehighlighter1_759_795_Closed_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_759_795_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_759_795_Closed_Text.style.display='none'; Codehighlighter1_759_795_Open_Image.style.display='inline'; Codehighlighter1_759_795_Open_Text.style.display='inline';" src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>            </span><span id=Codehighlighter1_759_795_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_759_795_Open_Text><span style="COLOR: #000000">{ </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">如果有多个,则输出多?/span><span style="COLOR: #008000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">out</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">i</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>            }</span></span><span style="COLOR: #000000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</span></span><span style="COLOR: #000000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">out</span><span style="COLOR: #000000">.close();<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">.close();<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">;<br><img src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">#endif</span></div> <img src ="http://m.shnenglu.com/shexinwei/aggbug/127153.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/shexinwei/" target="_blank">马赛?07</a> 2010-09-20 17:33 <a href="http://m.shnenglu.com/shexinwei/archive/2010/09/20/127153.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>判断整型C每一位的?C++)http://m.shnenglu.com/shexinwei/archive/2010/09/13/126526.html马赛?07马赛?07Mon, 13 Sep 2010 12:48:00 GMThttp://m.shnenglu.com/shexinwei/archive/2010/09/13/126526.htmlhttp://m.shnenglu.com/shexinwei/comments/126526.htmlhttp://m.shnenglu.com/shexinwei/archive/2010/09/13/126526.html#Feedback4http://m.shnenglu.com/shexinwei/comments/commentRss/126526.htmlhttp://m.shnenglu.com/shexinwei/services/trackbacks/126526.html
 1/*
 2Subject:        the value of the each bit on int
 3Author:         shexinwei
 4School:         xidian university
 5Date:           2010-09-13
 6Laguage:        C++
 7IDE:            visual studio 6.o
 8Version:        1.0
 9Modify Time:    2010-09-13
10*/

11#include <iostream>
12using namespace std;
13int main()
14{
15    int i = 0;
16    cout<<"please input the number:";
17    cin>>i;
18    char *result = new char[sizeof(int)*8];
19    int j = 1;
20    for (int k = 0;k<sizeof(int)*8;(j=j<<1),k++)
21    {
22        if ( (i&j) == 0 )
23        {
24            result[k] = '0';
25        }

26        else result[k] = '1';
27    }

28    for (int m = sizeof(int)*8-1;m >=0 ; m--)
29{
30        cout<<result[m];
31    }

32    cout<<endl;
33    delete []result;
34    return 1;
35}


马赛?07 2010-09-13 20:48 发表评论
]]>
快速排?C++)http://m.shnenglu.com/shexinwei/archive/2010/09/12/126468.html马赛?07马赛?07Sun, 12 Sep 2010 09:02:00 GMThttp://m.shnenglu.com/shexinwei/archive/2010/09/12/126468.htmlhttp://m.shnenglu.com/shexinwei/comments/126468.htmlhttp://m.shnenglu.com/shexinwei/archive/2010/09/12/126468.html#Feedback1http://m.shnenglu.com/shexinwei/comments/commentRss/126468.htmlhttp://m.shnenglu.com/shexinwei/services/trackbacks/126468.html  1 //版权声明Q{载时请以链接Ş式标明文章原始出处和作者信息及本声?br>  2 //http://shexinwei.blogbus.com/logs/74827291.html
  3 
  4 
  5 /*
  6 
  7 Subject:      Quick sort
  8 
  9 Author:       shexinwei
 10 
 11 School:       xidian university
 12 
 13 Date:         2010-09-12
 14 
 15 Laguage:      C++
 16 
 17 IDE | Tool:   GCC
 18 
 19 Version:      1.0
 20 
 21 Modify Time:  2010-09-12
 22 
 23 */    
 24 
 25 #include <iostream>
 26 
 27 using namespace std;
 28 
 29 int sort(int begin,int end,int data[],int n);
 30 
 31 int recurs(int begin,int end,int data[],int n);
 32 
 33 int print(int data[],int n);
 34 
 35 int main()
 36 
 37 {
 38 
 39     int data[] = {20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
 40 
 41     //打印初始序列
 42 
 43     print(data,20);
 44 
 45     //递归排序
 46 
 47     recurs(0,19,data,20);
 48 
 49     //打印最l序?nbsp;   
 50 
 51     print(data,20);
 52 
 53     cout<<endl;
 54 
 55         return 1;
 56 
 57 }
 58 
 59  
 60 
 61 //打印序列
 62 
 63 int print(int data[],int n)
 64 
 65 {
 66 
 67     for(int i = 0;i<n;i++)
 68 
 69         cout<<data[i]<<" ";
 70 
 71     cout<<endl;
 72 
 73     return 1;
 74 
 75 }
 76 
 77  
 78 
 79  
 80 
 81 int sort(int begin,int end,int data[],int n)
 82 
 83 {
 84 
 85     //选择最后一位做初始的中?/span>
 86 
 87     int pos = end;
 88 
 89     int key  = data[end];
 90 
 91     //索引初始?/span>
 92 
 93     int front = begin;
 94 
 95     int last = end;
 96 
 97     for(;front != last;front++)
 98 
 99     { //向后查找
100 
101  
102 
103         if((data[front] < key) || (data[front] == key)) continue;
104 
105         else
106 
107         { //遇到比中枢值大的元素,交换位置Q修改pos的|q开始从后向前找
108 
109             data[pos] = data[front];
110 
111             pos = front;
112 
113             //以下一句可注释Q只需要保存中枢的位置Q可以不修改|因中枢值在key中保存,最后找到最l位|后再赋值即?/span>
114 
115             data[pos] = key;     
116 
117             //输出改变一ơ后的序?/span>
118 
119             print(data,n);
120 
121             for(;front != last;last--)
122 
123             {//从后向前查找
124 
125                 if((data[last] > key)||(data[last] == key)) continue;
126 
127                 else
128 
129                 { //遇到比中枢值小的元素,交换位置Q修改pos|q新开始从前向后查?/span>
130 
131                    data[pos] = data[last];
132 
133                    pos = last;
134 
135                  //以下一句可注释Q只需要保存中枢的位置Q可以不修改|因中枢值在key中保存,最后找到最l位|后再赋值即?/span>
136 
137                        data[pos] = key;
138 
139                  //打印修改以后的序?/span>
140 
141                    print(data,n); 
142 
143                  //重新开始从前向后查?/span>
144 
145                    break;
146 
147                 }
148 
149             }
150 
151             
152 
153         }
154 
155         //如果从后向前已经使得front==lastQ那么一分割完?/span>
156 
157         if(front == last) break;
158 
159     }
160 
161     data[pos] = key;
162 
163     return pos;
164 
165 }
166 
167 int recurs(int begin,int end,int data[],int n)
168 
169 {
170 
171     //递归出口
172 
173     if((begin == end) || (begin > end)) return 1;
174 
175     else
176 
177     {
178 
179     //做分?/span>
180 
181     int index = sort(begin,end,data,n);
182 
183     //前一部分递归
184 
185     recurs(begin,index-1,data,n);
186 
187     //后一部分递归
188 
189     recurs(index+1,end,data,n);
190 
191     }
192 
193 }

马赛?07 2010-09-12 17:02 发表评论
]]>
the difference of some Input functionhttp://m.shnenglu.com/shexinwei/archive/2010/09/10/126284.html马赛?07马赛?07Fri, 10 Sep 2010 00:44:00 GMThttp://m.shnenglu.com/shexinwei/archive/2010/09/10/126284.htmlhttp://m.shnenglu.com/shexinwei/comments/126284.htmlhttp://m.shnenglu.com/shexinwei/archive/2010/09/10/126284.html#Feedback0http://m.shnenglu.com/shexinwei/comments/commentRss/126284.htmlhttp://m.shnenglu.com/shexinwei/services/trackbacks/126284.html 1 /* 2 Subject: the difference of gets(),getch(),getchar() and getline() 3 Author: shexinwei 4 School: xidian university 5 Date: 2010-09-09 6 Laguage: C++ 7 IDE: visual studio 6.o 8 Version: 1.0 9 Modify Time: 2010-09-09 10 */ 11 #include <iostream> 12 using namespace std; 13 #include <conio.h> 14 #define MAX_LEN 20 15 int main() 16 { 17 18 //gets() : Get a line from the stdin stream. 19 //Get a line from the stdin stream. 20 21 cout<<"the function gets():"<<endl; 22 char buffer[MAX_LEN]; 23 gets(buffer); 24 cout<<buffer<<endl; 25 26 // getchar(): 27 // marco: #define getchar() getc(stdin) File: STDIO.H Get a character from a file; 28 // function: _CRTIMP int __cdecl getchar(void); File: STDIO.H Get a character from stdin; 29 char tmp = 0; 30 cout<<endl<<endl<<"the function getchar():"<<endl; 31 cout<< (char)getchar(tmp) <<endl; 32 33 //getline(): 34 //basic_istream<Elem, Tr>& getline(char_type *_Str, streamsize _Count); 35 //Gets a line from the input stream. 36 cout<<endl<<endl<<"the function getline():"<<endl; 37 cin.getline(buffer,MAX_LEN); 38 cout<<buffer<<endl; 39 40 //getch(): 41 //This POSIX function is deprecated beginning in Visual C++ 2005. Use the ISO C++ conformant _getch instead 42 //Gets a character from the console without echo. 43 //int _getch( void ); 44 //Returns the character read. There is no error return. 45 //Headers: <conio.h> 46 cout<<endl<<endl<<"the function getch():"<<endl; 47 tmp = getch(); //without echo 48 // cout<<tmp<<endl; //print the character 49 50 51 system("pause"); 52 return 0; 53 54 }

马赛?07 2010-09-10 08:44 发表评论
]]>
版权声明文http://m.shnenglu.com/shexinwei/archive/2010/09/10/126283.html马赛?07马赛?07Fri, 10 Sep 2010 00:41:00 GMThttp://m.shnenglu.com/shexinwei/archive/2010/09/10/126283.htmlhttp://m.shnenglu.com/shexinwei/comments/126283.htmlhttp://m.shnenglu.com/shexinwei/archive/2010/09/10/126283.html#Feedback0http://m.shnenglu.com/shexinwei/comments/commentRss/126283.htmlhttp://m.shnenglu.com/shexinwei/services/trackbacks/126283.html

作ؓ一个专业的E序员,我们需要在每一个源文g中做一些版权声明性的注释。现在根据我所见到的,和自q理解Q定义一份属于我自己的版权声明文格式。不之处日后l添加补充?/p>

CZ

1 /* 2 Subject: the difference of gets(),getch(),getchar() and getline() 3 Author: shexinwei 4 School: xidian university 5 Date: 2010-09-09 6 Laguage: C++ 7 IDE: visual studio 6.o 8 Version: 1.0 9 Modify Time: 2010-09-09 10 */




马赛?07 2010-09-10 08:41 发表评论
]]>
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            ۺϾƷһ| ҹƷ| һ3dͬڵ| ɫۺۺ| ŷҹĻ| ŷҹtv| һŷպ| | ޸Ƶһ| ޹Ʒva߹ۿ| ȹƷƵ| þƵ| þۺ| һþþƷ| һƵ߿| ŷһþ| ޵Ӱ߿| ޹Ʒƾþ| ޹Ʒ| ޹Ʒwww| ޹þþþƷ| ޹ Ʒ| ߹ۿһ| պƵ߹ۿ| ҹƷ| þþƷһĻ| ѹۿƵ| һɫƬ| ޹ŷƷ| ¹͵ľƷ| ҹþþþþ | ޵һɫ| ޳| ɫһ| Ƶ߹ۿվ| ŷaaa| ޾ѡƵ| ҹƵ߹ۿ | þþþþþó| ŷ༫Ʒvideosbest°汾| ŷպhd| ŷһ| Ʒһ߹ۿ| һ߹ۿav| պƵһ߲ | Ʒݾþ| Ʒһþþ| ղ޾Ʒϵ| ˳˳߹ۿ| ŷ߸| þþþ| Ů| ˾þ| ũ帾ŮƷһ| Ů˾þþþëƬ| պҹavӰ| ŮƷƵ| ŷƵ߹ۿ| ŷ۴Ƭ| ޼ۺ| ŷĻ| ޸ƵĻ| ŷۺϹƷþö| ŷɫƵ| 99ŷþþþƷ| ŷվ| þþžžþƷֱ| Ʒþ7777| Ĺ˾Ʒ| ޾Ʒŷר| ŷƷ߹ۿ91| ޶Ƶ| þþƷƵ| ŷպƷþþ| ŷػһ| ƷŮþþþþ2018| һƬģ| ձһ| ŷƵ| ޵һվ| þþþþþþþþþþŮ| ޾ƷƷ벻99Ħ | ҹþþþþþþõӰԺ| ޹Ʒþþ| ŷ򸾽ֲ߹ۿ| ޳߹ۿ| þۺĻ| þóƵ| ɫavվ| ӰԺ| Ƶһ| Ʒһ| ҹƵ߹ۿһ| þ| ŷƷvպƷvƷv| ձ| ޾Ʒþþþþձ| ŷһ߹ۿ| һ| ҹŷƷþþþþþ| Ƶۺ| Ů㽶þ**ëƬƷ| һ| ŷպƷþ| ŷ| ŷһ| 99|һ| ŷѿ| 99Ʒþ| þþƷ| þü| ƷvƬ߹ۿ| ŷ˾Ʒ߹ۿ| ƷƬ| ޹һaëƬ| ɫһ| Ƶ1| պҹ| Ʒ| þþþþ| ƷþþþþþþƽƬ| ޵һ߹ۿ| ɫһ| þþwww| ƷƵһ| ޾ƷƬ| ޾Ʒҹ| ŷ| ŷ~վ| ģƷһ| ҹþƷþþþ| ҹƷþþþþþþ| Ʒݮѹۿ| һ ߹ۿƵ| ҹҹavһ| ŷһƵ| ŷƵ߹ۿ| ޹߳߹ۿ| þþ| ŷද| ŷղվ| ŷxxx߹ۿ| ŷպۺ | 91þþ޾Ʒ| ѹۿ߹ۿ| þһ| ޹һӰ| ޾Ʒþþþþ91| ŷһ| ޾ƷƷþ崿ֱ| ޾Ʒ͵Բ99| ŮͼƬһ| ŷձһ| | ŷպַ| ߹ۿ| þ͵Ƶ| ŷձ| Ʒ99ӿ9| 㽶þù| ŷƷĻ| պһƵ| ŷҹƵ߹ۿ| ŷһƬ| ޵һƷӰ| רһ| ձŷ| 鶹avһ| ŮƵ| þùƷþþþþ| պavƬ| ŷպҹ| ŷƵվ| Ƶ| þùƷһ| ˾þɫۺ98| ŷպۺһ| þþƷ | ŷһ| ŷҹ߿Ƭ| һƵۿ| ޼Ƶ| ŷ߲| þùھƷ400| պƵѹۿ| aŹ˾Ʒ| Ůav| һ| ھƷþþþþþӰ | ŷպ999| av߲һ| 㽶Ƶ߹ۿ| պƵƷ߹ۿ| ŷһ| þþ999| ŷһһ| ŮƵ| һպ߹ۿ| ޹Ʒ˾þþ | ŷպ޾Ʒ|