码迷,mamicode.com
首页 >  
搜索关键字:while break continue    ( 40024个结果
c++ 快速排序
介绍给大家一个快速排序的方法: void sort(int  a[ ], int l, int r) { int i = l; int j = r; int mid = a[(i+j)/2];      do   {         while(a[i] while(a[j] >mid ) j--; if( i { swap( a[i], a[j] ); }...
分类:编程语言   时间:2014-06-20 13:15:03    阅读次数:292
约瑟夫问题
/**给定正整数k( 2 int joseph(int k){ 3 int m,t,a=1,b,i,n; 4 while(1){ 5 for(b=1;bk)14 return m;15 }16 a+=2;...
分类:其他好文   时间:2014-06-10 00:17:35    阅读次数:261
一入python深似海--split
下面说说split函数的用法 def break_words(stuff): """This function will break up words for us.""" words = stuff.split(' ')#split('.',1) use '.' split one time return words def sort_words(wo...
分类:编程语言   时间:2014-06-08 18:19:21    阅读次数:336
List集合中两种遍历方式
遍历List集合中的元素的方法有两种: 第一种:利用迭代器遍历 代码1: // 迭代器 Iterator it=list.iterator(); while(it.hasNext()) { System.out.println(it.next()); }或者代码2: for(Iterator it=list.iterator();it.hasNext();) { System.o...
分类:其他好文   时间:2014-06-08 15:22:50    阅读次数:189
2014年6月7日03:49:28
1 //break是结束整个循环体,退出了整个while循环 2 3 int x = 0; 4 while (x++ < 10) 5 { 6 if (x == 3) 7...
分类:其他好文   时间:2014-06-07 16:53:19    阅读次数:190
Word Break II
题目 方法...
分类:其他好文   时间:2014-06-07 15:38:42    阅读次数:143
十五周 项目1 工资数据的输入
/* 输入员工工资1000-10000之间,并按从大到小输出*/ #include using namespace std; int main( ) { double salarys[500]; int n=0; double t; while(cin>>salarys[n]) { n++; //从cin流读取数据 ...
分类:其他好文   时间:2014-06-07 15:36:38    阅读次数:191
Word Break
题目 Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For example, given s = "leetcode", dict =...
分类:其他好文   时间:2014-06-07 13:53:28    阅读次数:247
关于c++primer的一个代码错误
最近看c++primer第四版的标准容器vector,讲到对vector容器的插入删除元素会使得end()的迭代器失效的问题,所以不建议程序员对end()的存储。 vector vec; vector::iterator first=vec.begin(); while(first!=vec.end()) { first=vec.insert(first,12); first...
分类:编程语言   时间:2014-06-07 13:04:13    阅读次数:230
ORACLE11.2.0 SQLPLUS 报 error while loading shared libraries
在vm下redhat5下安装oracle 11g后,登录sqlplus 报: sqlplus: error while loading shared libraries: /home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1: cannot restore segment prot after reloc:...
分类:数据库   时间:2014-06-07 12:00:29    阅读次数:303
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!