c++编程 冒泡排序

Contributor:缪雪儿、佛兰 Type:代码 Date time:2019-02-11 11:13:09 Favorite:40 Score:1.5
返回上页 Report
请选择举报理由:




Collection Modify the typo
#include<iostream>
using namespace std;
void maopao(int a[],int size)
{int temp,work;
for(int pass=1;pass<size;pass++)
{work=1;
for(int i=0;i<size-pass;i++)
{if(a[i]>a[i+1])
{temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
work=0;
}}if(work) break;
}}int main()
{int a[100],i,size;
size=0;
for(i=0;;i++)
{cin>>a[i];
if(a[i]==0) break;
size++;
}maopao(a,size);
for(int i=0;i<size;i++)
cout<<a[i]<<" ";
}
声明:以上文章均为用户自行添加,仅供打字交流使用,不代表本站观点,本站不承担任何法律责任,特此声明!如果有侵犯到您的权利,请及时联系我们删除。
Hot degree:
Difficulty:
quality:
Description: the system according to the heat, the difficulty, the quality of automatic certification, the certification of the article will be involved in typing!

This paper typing ranking TOP20

登录后可见

用户更多文章推荐