亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dynamicarrays.cpp

?? 一些symbian開發的小例子
?? CPP
字號:
// DynamicArrays.cpp

//Author:LiuLiPing
//version 1.0
//Date: 2006-2-18

// Examples to demonstrate arrays

#include "CommonFramework.h"
#include <e32math.h>

void FruitRArray();
void FruitFixFlat();

//
// Common literal text
//

_LIT(KMsgPressAnyKey," (press any key to continue)\n");
_LIT(KMsgInsert,"\n\n--->InsertL\n");
_LIT(KMsgModify,"\n\n--->Modify\n");
_LIT(KMsgDelete,"\n\n--->Delete\n");
_LIT(KMsgFind,"\n\n--->Find\n");
_LIT(KMsgSortID,"\n\n--->SortID\n");
_LIT(KMsgSortName,"\n\n--->SortName\n");
_LIT(KMsgNewLine,"\n");

//
// Common format strings
//

_LIT(KName,"Name is:");
_LIT(KID,"ID is: %d\n");
_LIT(KPrice,"Price is: %f\n");

//
// A T type class used in the example demonstrating the:
// RArray class and CArrayFixFlat class
// 
class TFruit
	{
public :
	TFruit(TInt aID, const TDesC& aName, TReal aPrice);
	~TFruit();
public :
	TInt iID;		//水果的ID
	HBufC* iName;	//水果名
	TReal iPrice;	//水果的單價
	};

TFruit::TFruit(TInt aID, const TDesC& aName, TReal aPrice)
{
	iID = aID;
	iName = aName.Alloc();
	iPrice = aPrice;
}
TFruit::~TFruit()
{
	delete iName;
	iName = NULL;
	iID = 0;
	iPrice = 0;
}

//
//比較ID ,用于按水果的ID排序(從1——n)
//

TInt CompareFruitID(const TFruit& aFruit1, const TFruit& aFruit2)
{
	if(aFruit1.iID>aFruit2.iID)
		return 1;
	if(aFruit1.iID==aFruit2.iID)
		return 0;
	else 
		return -1;
}

//
//比較名字,用于按水果的名字排序(從A——Z)
//

TInt CompareFruitName(const TFruit& aFruit1, const TFruit& aFruit2)
{
	TPtr ptr1 =aFruit1.iName->Des();
    TPtr ptr2 =aFruit2.iName->Des();
	return ptr1.Compare(ptr2);
}

//
//比較兩個水果名是否相同(用于查找)
//

TBool FindFruitName(const TFruit& aFruit1, const TFruit& aFruit2)
{
	if(*aFruit1.iName==(*aFruit2.iName))
		return ETrue;
	else 
		return EFalse;
}

void FruitRArray()
{
	RArray<TFruit> rarray;      //用RArray類存儲數據
    CleanupClosePushL(rarray);	//壓入清理棧

	_LIT(KFruit1,"watermelon");
	TBuf<12> buf1(KFruit1);
	_LIT(KFruit2,"peach");
	TBuf<10> buf2(KFruit2);
	_LIT(KFruit3,"orange");
	TBuf<10> buf3(KFruit3);

	TFruit fruit1(1,buf1,1.5);
	TFruit fruit2(2,buf2,2.8);
	TFruit fruit3(3,buf3,1.2);

	rarray.Append(fruit1);		//添加數據到數組中
	rarray.Append(fruit2);
    for(TInt i=0;i<rarray.Count();i++)	//顯示數組中所有的數據
	{
	  console->Printf(KID,rarray[i].iID);
	  console->Printf(KName);
	  TPtr ptr = rarray[i].iName->Des();
	  console->Printf(ptr);
      console->Printf(KMsgNewLine);
	  console->Printf(KPrice,rarray[i].iPrice);
	  console->Printf(KMsgNewLine);
	}

	console->Printf(KMsgPressAnyKey);
	console->Getch();
	console->Printf(KMsgInsert);
	rarray.Insert(fruit3,0);		//向數組插入數據,插入的數據是數組的第一個元素
    for(i=0;i<rarray.Count();i++)
	{
	  console->Printf(KID,rarray[i].iID);
	  console->Printf(KName);
	  TPtr ptr = rarray[i].iName->Des();
	  console->Printf(ptr);
      console->Printf(KMsgNewLine);
	  console->Printf(KPrice,rarray[i].iPrice);
	  console->Printf(KMsgNewLine);
	}
	console->Printf(KMsgPressAnyKey);
	console->Getch();
	console->Printf(KMsgModify);
	_LIT(KNewFruit,"apple");
	TBuf<10> buf(KNewFruit);
	rarray[1].iName = buf.Alloc();	//修改數組第二個元素的名字
    for(i=0;i<rarray.Count();i++)
	{
	  console->Printf(KID,rarray[i].iID);
	  console->Printf(KName);
	  TPtr ptr = rarray[i].iName->Des();
	  console->Printf(ptr);
      console->Printf(KMsgNewLine);
	  console->Printf(KPrice,rarray[i].iPrice);
	  console->Printf(KMsgNewLine);
	}
	delete rarray[1].iName;	

	console->Printf(KMsgPressAnyKey);
	console->Getch();
	console->Printf(KMsgFind);
    TInt findPos;			
    TFruit S1(1,buf1,1.5);	
    if((findPos=rarray.Find(S1))!=KErrNotFound)		//在數組中查找名buf1的水果,如果有就打印該水果的名字
	{
	  TPtr ptr = rarray[findPos-1].iName->Des();
	  console->Printf(_L("Find!!"));
      console->Printf(ptr);
	  console->Printf(KMsgNewLine);
	}
    TFruit S2(0,buf2,0);
	TIdentityRelation<TFruit> find(FindFruitName);
    if((findPos=rarray.Find(S2,find))!=KErrNotFound)//在數組中查找名buf1的水果,如果有就打印該水果的名字
	{
	  TPtr ptr = rarray[findPos].iName->Des();
	  console->Printf(_L("Find!!"));
      console->Printf(ptr);
	  console->Printf(KMsgNewLine);
	}

	console->Printf(KMsgPressAnyKey);
	console->Getch();
	console->Printf(KMsgSortID);
    TLinearOrder<TFruit> sort1(CompareFruitID);	//按照水果的ID排序
    rarray.Sort(sort1);
    for(i=0;i<rarray.Count();i++)
	{
	  console->Printf(KID,rarray[i].iID);
	  console->Printf(KName);
	  TPtr ptr = rarray[i].iName->Des();
	  console->Printf(ptr);
      console->Printf(KMsgNewLine);
	  console->Printf(KPrice,rarray[i].iPrice);
	  console->Printf(KMsgNewLine);
	}

	console->Printf(KMsgPressAnyKey);
	console->Getch();
	console->Printf(KMsgSortName);
    TLinearOrder<TFruit> sort2(CompareFruitName);	//按照水果的名字排序
    rarray.Sort(sort2);
    for(i=0;i<rarray.Count();i++)
	{
	  console->Printf(KID,rarray[i].iID);
	  console->Printf(KName);
	  TPtr ptr = rarray[i].iName->Des();
	  console->Printf(ptr);
      console->Printf(KMsgNewLine);
	  console->Printf(KPrice,rarray[i].iPrice);
	  console->Printf(KMsgNewLine);
	}
	
	rarray.Reset();
	CleanupStack::PopAndDestroy();
}		 
void FruitFixFlat()
{
	CArrayFixFlat<TFruit>* fixflat;		//用CArrayFixFlat存儲數據
	fixflat= new (ELeave) CArrayFixFlat<TFruit>(5);	//申請空間

	_LIT(KFruit1,"watermelon");
	TBuf<12> buf1(KFruit1);
	_LIT(KFruit2,"peach");
	TBuf<10> buf2(KFruit2);
	_LIT(KFruit3,"orange");
	TBuf<10> buf3(KFruit3);

	TFruit fruit1(1,buf1,1.5);
	TFruit fruit2(2,buf2,2.8);
	TFruit fruit3(3,buf3,1.2);
	
	fixflat->AppendL(fruit1);		//將數據添加到數組中
	fixflat->AppendL(fruit2);

    for(TInt i=0;i<fixflat->Count();i++)	//顯示數組中所有的數據
	{
	  console->Printf(KID,(*fixflat)[i].iID);
	  console->Printf(KName);
	  TPtr ptr = (*fixflat)[i].iName->Des();
	  console->Printf(ptr);
      console->Printf(KMsgNewLine);
	  console->Printf(KPrice,(*fixflat)[i].iPrice);
	  console->Printf(KMsgNewLine);
	}

	console->Printf(KMsgPressAnyKey);
	console->Getch();
	console->Printf(KMsgInsert);
	fixflat->InsertL(0,fruit3);			//向數組插入數據,插入數據是數組的第一個元素
    for(i=0;i<fixflat->Count();i++)
	{
	  console->Printf(KID,(*fixflat)[i].iID);
	  console->Printf(KName);
	  TPtr ptr = (*fixflat)[i].iName->Des();
	  console->Printf(ptr);
      console->Printf(KMsgNewLine);
	  console->Printf(KPrice,(*fixflat)[i].iPrice);
	  console->Printf(KMsgNewLine);
	}

	console->Printf(KMsgPressAnyKey);
	console->Getch();
	console->Printf(KMsgModify);
	_LIT(KNewFruit,"apple");
	TBuf<10> buf(KNewFruit);
	(*fixflat)[1].iName = buf.Alloc();	//修改數組第二個元素的名字
    for(i=0;i<fixflat->Count();i++)
	{
	  console->Printf(KID,(*fixflat)[i].iID);
	  console->Printf(KName);
	  TPtr ptr = (*fixflat)[i].iName->Des();
	  console->Printf(ptr);
      console->Printf(KMsgNewLine);
	  console->Printf(KPrice,(*fixflat)[i].iPrice);
	  console->Printf(KMsgNewLine);
	}
	delete (*fixflat)[1].iName;

	console->Printf(KMsgPressAnyKey);
	console->Getch();
	console->Printf(KMsgDelete);
	fixflat->Delete(1);				//刪除數組第二個元素
    for(i=0;i<fixflat->Count();i++)
	{
	  console->Printf(KID,(*fixflat)[i].iID);
	  console->Printf(KName);
	  TPtr ptr = (*fixflat)[i].iName->Des();
	  console->Printf(ptr);
      console->Printf(KMsgNewLine);
	  console->Printf(KPrice,(*fixflat)[i].iPrice);
	  console->Printf(KMsgNewLine);
	}

	console->Printf(KMsgPressAnyKey);
	console->Getch();
	console->Printf(KMsgFind);
	TKeyArrayFix nameKey(_FOFF(TFruit,iName),ECmpNormal);
    TInt findPos;
    TFruit S(2,buf2,2);		//在數組中查找名為buf2的元素,如果有打印該水果的名字
    if(fixflat->Find(S,nameKey,findPos)!=KErrNotFound)
	{
	  TPtr ptr = (*fixflat)[findPos-1].iName->Des();
	  console->Printf(_L("Find!!"));
      console->Printf(ptr);
	  console->Printf(KMsgNewLine);
	}

	console->Printf(KMsgPressAnyKey);
	console->Getch();
	console->Printf(KMsgSortID);
    TKeyArrayFix IDKey(_FOFF(TFruit,iID),ECmpTInt32);
    User::LeaveIfError(fixflat->Sort(IDKey));	//按照水果的ID排序
    for(i=0;i<fixflat->Count();i++)
	{
	  console->Printf(KID,(*fixflat)[i].iID);
	  console->Printf(KName);
	  TPtr ptr = (*fixflat)[i].iName->Des();
	  console->Printf(ptr);
      console->Printf(KMsgNewLine);
	  console->Printf(KPrice,(*fixflat)[i].iPrice);
	  console->Printf(KMsgNewLine);
	}
	delete fixflat;
}

// Do the example
LOCAL_C void doExampleL()
{		
	console->Printf(_L("*****Rarray*****\n"));
	FruitRArray();
	console->Printf(_L("\n***CArrayFixFlat***\n"));
	FruitFixFlat();
}

 	



	
	

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产a区久久久| 五月婷婷另类国产| 成人av在线影院| 国产精品久久久久久久第一福利 | 91成人在线观看喷潮| 亚洲欧美日韩国产另类专区| 99精品黄色片免费大全| 一区二区三区丝袜| 欧美日韩卡一卡二| 六月婷婷色综合| 中国av一区二区三区| 91在线精品秘密一区二区| 亚洲韩国一区二区三区| 91精品国产色综合久久不卡蜜臀 | 精品久久久三级丝袜| 国产一区二区三区av电影| 国产精品区一区二区三| 日本国产一区二区| 久久狠狠亚洲综合| 国产精品久久一卡二卡| 欧美日韩一区在线| 国内成+人亚洲+欧美+综合在线| 日本一区二区在线不卡| 欧美午夜精品电影| 精品一区二区免费看| 亚洲另类在线视频| 精品欧美乱码久久久久久1区2区| 丰满少妇在线播放bd日韩电影| 一区二区三区毛片| 欧美va亚洲va在线观看蝴蝶网| 福利一区二区在线观看| 五月天久久比比资源色| 国产日韩av一区| 在线播放国产精品二区一二区四区 | 亚洲免费观看在线视频| 精品国免费一区二区三区| 99久久精品国产毛片| 精一区二区三区| 亚洲午夜免费视频| 国产欧美日韩另类视频免费观看| 欧美日韩中文字幕一区二区| 国产91精品精华液一区二区三区 | 日本不卡的三区四区五区| 日本一区二区免费在线观看视频| 欧美日本在线播放| 99久久精品免费观看| 国产毛片一区二区| 亚洲高清免费视频| 中文字幕国产一区二区| 欧美电影免费观看高清完整版| 色综合网站在线| 国产亚洲一区二区三区四区| 欧美视频在线一区二区三区 | 成人综合婷婷国产精品久久免费| 午夜av电影一区| 亚洲视频一区在线| 国产无遮挡一区二区三区毛片日本| 91精品一区二区三区久久久久久| 色欧美乱欧美15图片| heyzo一本久久综合| 精品一区二区日韩| 美女视频网站久久| 亚洲大型综合色站| 亚洲一区二区在线免费看| 中文字幕色av一区二区三区| 亚洲精品在线观看网站| 精品久久免费看| 欧美一区二区网站| 5858s免费视频成人| 欧美日韩中文另类| 欧美日韩在线直播| 欧美日韩一区二区三区不卡| 在线看不卡av| 欧美色图片你懂的| 欧美视频中文字幕| 欧美视频在线不卡| 欧美日韩一区二区三区高清 | 成人午夜免费视频| 国产传媒一区在线| 国产白丝网站精品污在线入口| 国产在线不卡视频| 国产91清纯白嫩初高中在线观看| 国产精品一区二区在线播放| 国产成人精品免费在线| 成人免费看片app下载| 成人免费毛片高清视频| 91在线视频网址| 欧美在线小视频| 在线不卡的av| 欧美成人乱码一区二区三区| 久久久久一区二区三区四区| 国产精品理论在线观看| 亚洲日本丝袜连裤袜办公室| 亚洲综合网站在线观看| 日韩福利视频导航| 激情成人综合网| 成人一区二区三区视频在线观看| 99re66热这里只有精品3直播 | 国产大陆亚洲精品国产| 97se亚洲国产综合自在线| 在线亚洲高清视频| 日韩午夜在线观看视频| 久久免费的精品国产v∧| 最好看的中文字幕久久| 亚洲国产欧美在线| 久久国产麻豆精品| 成人久久18免费网站麻豆| 91黄色免费版| 日韩午夜激情视频| 国产精品久99| 日日夜夜一区二区| 国产激情精品久久久第一区二区 | 亚洲精品成a人| 日本欧美一区二区| 欧美精品一区二区蜜臀亚洲| 国产亚洲一区二区三区四区| 国产精品色眯眯| 亚洲成人高清在线| 丁香网亚洲国际| 欧美日韩久久一区| 国产三区在线成人av| 亚洲在线免费播放| 国产成a人亚洲| 91麻豆精品国产91久久久使用方法 | 欧美一区二区三区免费在线看| 国产人成亚洲第一网站在线播放 | 日本亚洲三级在线| 99久久精品免费精品国产| 日韩一区二区免费电影| 国产精品福利一区| 国产原创一区二区三区| 欧美日韩在线播放三区| 中文字幕亚洲区| 国产自产2019最新不卡| 51久久夜色精品国产麻豆| 亚洲视频一二区| 国产99久久久国产精品| 精品欧美久久久| 婷婷开心激情综合| 欧美性受xxxx黑人xyx| ●精品国产综合乱码久久久久| 六月丁香婷婷久久| 欧美精品乱码久久久久久| 亚洲色图第一区| 丁香激情综合五月| 精品国产一二三| 免费成人在线网站| 欧美精品在线一区二区| 亚洲综合精品自拍| 91美女福利视频| 国产精品久久久久久久久免费相片| 美日韩一区二区三区| 欧美精品在线视频| 亚洲精选在线视频| 色综合久久天天| 亚洲人成网站精品片在线观看| 成人综合日日夜夜| 欧美激情一区二区三区不卡 | 亚洲综合在线免费观看| aa级大片欧美| 最新成人av在线| 色综合久久综合| 夜夜亚洲天天久久| 在线精品视频免费播放| 亚洲精品老司机| 欧美主播一区二区三区| 亚洲成人动漫av| 欧美精品亚洲一区二区在线播放| 性欧美疯狂xxxxbbbb| 欧美视频日韩视频在线观看| 亚洲一区二区三区自拍| 欧美久久久久中文字幕| 美女爽到高潮91| 久久久美女艺术照精彩视频福利播放| 精品影视av免费| 国产日韩精品久久久| 99久久久国产精品免费蜜臀| 伊人夜夜躁av伊人久久| 欧美性色欧美a在线播放| 亚洲成人av在线电影| 欧美一区二区福利视频| 麻豆精品一二三| 久久精品夜色噜噜亚洲aⅴ| 国产99精品国产| 亚洲精品水蜜桃| 欧美男生操女生| 黄色成人免费在线| 亚洲欧洲国产专区| 欧美日韩高清一区二区不卡| 日韩电影免费在线观看网站| 久久影院视频免费| a在线播放不卡| 午夜精品久久久久久久蜜桃app| 88在线观看91蜜桃国自产| 精品亚洲国产成人av制服丝袜| 久久久久国产免费免费 | 一区二区三区免费在线观看| 在线成人小视频| 国产精品资源网| 一区二区三区四区不卡视频|