Fork me on GitHub
上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 125 下一页

2012年4月4日

摘要: 一,STL中的有无改变算法和有改变算法:无改变算法有:1,find 这个算法是最常用的无改变查找算法, 线性时间特性O(N),用于在未排序的勇气元素序列中查找元素。只在元素数量较少的情况下使用。例如:可以搜索游戏玩家列表或者搜索本地又似玩家已经建立的不同人物,但是尽量要避免使用这一算法在游戏中搜索指定的游戏实体。代码如: list<string> PlayerName if(find(playerNames.begin(),playerNames.end(),wantedName)==playerNames.end()) { // 查到Name后,做其他事。。。。 } 2 for_ 阅读全文
posted @ 2012-04-04 22:18 pengyingh 阅读(226) 评论(0) 推荐(0)
摘要: #include<iostream>#include<string>#include<cmath>usingnamespacestd;constdoublePRECISION=1E-6;constintCOUNT_OF_NUMBER=4;constintNUMBER_TO_BE_CAL=24;doublenumber[COUNT_OF_NUMBER];stringexpression[COUNT_OF_NUMBER];boolSearch(intn){if(n==1){if(fabs(number[0]-NUMBER_TO_BE_CAL)<PRECIS 阅读全文
posted @ 2012-04-04 22:17 pengyingh 阅读(402) 评论(0) 推荐(0)
摘要: #include<iostream>#include<algorithm>#include<vector>#include<iomanip>usingnamespacestd;//引以为荣的程序.还有几个小部分改,以待完美.constintN=7,MAX=1000;classPrimTree{intmap[N][N];boolbeVisited[N];boolbeExist[N];intcount;intPass[N];public:PrimTree(inttable[][N]);//构建Prim树intGo(intstartnode,inten 阅读全文
posted @ 2012-04-04 22:16 pengyingh 阅读(526) 评论(0) 推荐(0)
摘要: #include<cmath>#include<iostream>#include<fstream>usingnamespacestd;constintN=8;//默认为八皇后.intcount=0;voidDisplay(int*RowLoc,ostream&c){c<<"---------------"<<++count<<"-------"<<endl;for(inti=0;i<N;i++){for(intj=0;j<N;j++){c<&l 阅读全文
posted @ 2012-04-04 22:14 pengyingh 阅读(181) 评论(0) 推荐(0)
摘要: 1.将一个指定的图形放大或缩小为指定的尺寸,可以试试以下代码-(UIImage*)scaleToSize:(UIImage*)imgsize:(CGSize)size{ //创建一个bitmap的context //并把它设置成为当前正在使用的context UIGraphicsBeginImageContext(size); //绘制改变大小的图片 [imgdrawInRect:CGRectMake(0,0,size.width,size.height)]; //从当前context中创建一个改变大小后的图片 UIImage*scaledImage=UIGraphicsGetImag... 阅读全文
posted @ 2012-04-04 22:09 pengyingh 阅读(400) 评论(0) 推荐(0)
摘要: Below is a template for the singletons that we use in objective-c.MySingleton.h:#import <Foundation/Foundation.h>@interface MySingleton : NSObject {}+(MySingleton*)sharedMySingleton;-(void)sayHello;@endMySingleton.m:@implementation MySingletonstatic MySingleton* _sharedMySingleton = nil;+(MySi 阅读全文
posted @ 2012-04-04 21:47 pengyingh 阅读(194) 评论(0) 推荐(0)
摘要: http://www.cppblog.com/zhangyuntaoshe/articles/123822.html?opt=admin1.UIViewController:重要属性:viewtitleinterfaceOrientationtabBarControllertabBarItemnavigationControllernavigationItemparentViewController重要方法:viewDidLoadviewDidUnloadviewWillAppearviewWIllDisappearpresentModalViewControllerdismissModalV 阅读全文
posted @ 2012-04-04 21:45 pengyingh 阅读(219) 评论(0) 推荐(0)

2012年4月2日

摘要: http://blog.csdn.net/ipromiseu/article/details/7031084很多时候我们的程序操作结构都是UITabBarController+UINavigationController,每个UITabBarController item里面都有很多层的UINavigationController,而UITabBarController默认有一个事件就是双击UITabBarController item时,会把这个item里的UINavigationController pop 到root,而我们有时不希望一下子就pop到了根视图,因为可能还会有一些逐层处理功 阅读全文
posted @ 2012-04-02 13:49 pengyingh 阅读(1054) 评论(0) 推荐(0)
摘要: 文章:http://blog.csdn.net/iukey/article/details/7318290在 UIKit 中UITabbar 代表了标签栏,而 UITabBarController 对其进行了封装,令多个不同的视图管理与切换变的更加轻松。构建一个标签栏控制器,首先要为每个按钮准备一个单独的页。每一页都应被创建为UIViewController对象。构建一个控制器数组:你的应用程序可能有多个不同的试图控制器,来实现不同的功能。如果你在写一个音乐播放器,可能会有一些控制器,如:MusicList、CurrentPlay、Favourite、SingerList、Settings 等 阅读全文
posted @ 2012-04-02 12:19 pengyingh 阅读(1253) 评论(1) 推荐(0)
摘要: http://blog.csdn.net/iukey/article/details/7319314UIScrollView 类负责所有基于 UIKit 的滚动操作。一、创建CGRect bounds = [ [ UIScreen mainScreen ] applicationFrame ] ; UIScrollView* scrollView = [ [UIScrollView alloc ] initWithFrame:bounds ]; 当你创建完滚动视图后,你可以将另一个视图的内容粘合到滚动视图的空白页上。这回创建一个滚动的内容窗口:[ scrollView addSubview.. 阅读全文
posted @ 2012-04-02 11:51 pengyingh 阅读(4966) 评论(1) 推荐(0)
上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 125 下一页

导航