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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dynamicarrays.cpp

?? 一個學(xué)習(xí)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類存儲數(shù)據(jù)
    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);		//添加數(shù)據(jù)到數(shù)組中
	rarray.Append(fruit2);
    for(TInt i=0;i<rarray.Count();i++)	//顯示數(shù)組中所有的數(shù)據(jù)
	{
	  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);		//向數(shù)組插入數(shù)據(jù),插入的數(shù)據(jù)是數(shù)組的第一個元素
    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();	//修改數(shù)組第二個元素的名字
    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)		//在數(shù)組中查找名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)//在數(shù)組中查找名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存儲數(shù)據(jù)
	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);		//將數(shù)據(jù)添加到數(shù)組中
	fixflat->AppendL(fruit2);

    for(TInt i=0;i<fixflat->Count();i++)	//顯示數(shù)組中所有的數(shù)據(jù)
	{
	  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);			//向數(shù)組插入數(shù)據(jù),插入數(shù)據(jù)是數(shù)組的第一個元素
    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();	//修改數(shù)組第二個元素的名字
    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);				//刪除數(shù)組第二個元素
    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);		//在數(shù)組中查找名為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();
}

 	



	
	

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩国产色站一区二区三区| 久草精品在线观看| 99精品偷自拍| 中文字幕中文字幕一区二区| 不卡电影免费在线播放一区| 国产精品第13页| 91影院在线观看| 亚洲成人激情自拍| 777午夜精品免费视频| 精品一区二区三区免费视频| 久久你懂得1024| 成人av小说网| 亚洲成av人片| 精品国产区一区| 成人综合在线视频| 亚洲国产aⅴ成人精品无吗| 欧美高清视频不卡网| 国产一区二区视频在线| 最新国产精品久久精品| 欧美色爱综合网| 激情综合一区二区三区| 亚洲丝袜美腿综合| 日韩一级黄色大片| 成人性色生活片| 亚洲亚洲精品在线观看| 26uuuu精品一区二区| 99久久精品免费看国产| 午夜精品视频一区| 国产蜜臀av在线一区二区三区| 972aa.com艺术欧美| 日韩av电影免费观看高清完整版在线观看| 精品国产一区二区国模嫣然| 99国产精品久久久| 日韩黄色免费电影| 欧美国产丝袜视频| 欧美一区二区三区成人| eeuss鲁一区二区三区| 秋霞电影网一区二区| 国产精品久久久久久久岛一牛影视| 精品视频一区二区三区免费| 国产美女精品在线| 日韩精品成人一区二区在线| 中文一区一区三区高中清不卡| 欧美精品在线一区二区三区| 大美女一区二区三区| 美女在线观看视频一区二区| 亚洲欧美日韩中文播放| 久久免费精品国产久精品久久久久| 欧美最新大片在线看| 国产999精品久久| 久久精品噜噜噜成人av农村| 亚洲男人的天堂在线观看| 久久蜜桃av一区精品变态类天堂| 欧美午夜电影网| 99re成人在线| 成人免费精品视频| 精品一区二区三区在线观看| 婷婷夜色潮精品综合在线| 中文字幕日本乱码精品影院| 久久色在线观看| 91精品国产美女浴室洗澡无遮挡| 91久久一区二区| 不卡大黄网站免费看| 国产毛片精品一区| 美女爽到高潮91| 免费精品99久久国产综合精品| 亚洲线精品一区二区三区八戒| 亚洲欧美一区二区三区极速播放| 欧美国产1区2区| 国产日产欧美精品一区二区三区| 日韩精品一区二区在线观看| 欧美肥妇free| 欧美性感一类影片在线播放| 91久久精品一区二区三区| av在线一区二区| av电影在线观看一区| 春色校园综合激情亚洲| 成人av午夜影院| 成人教育av在线| av欧美精品.com| 91在线精品一区二区| 91免费小视频| 欧美亚洲综合在线| 欧美精品粉嫩高潮一区二区| 欧美日产国产精品| 日韩丝袜美女视频| 国产亚洲欧美日韩日本| 久久精品日产第一区二区三区高清版 | 国产成人综合自拍| 国产一区二区三区免费观看| 国产一区免费电影| 丁香婷婷综合色啪| 99精品一区二区三区| 欧美亚洲日本国产| 欧美日韩精品一区二区天天拍小说| 欧美日韩视频在线第一区 | 国产色产综合色产在线视频 | 91一区二区三区在线观看| 一本色道a无线码一区v| 99精品久久久久久| 欧美三级一区二区| 欧美α欧美αv大片| 国产欧美日韩一区二区三区在线观看 | 成人小视频在线| 色狠狠一区二区| 91精品国产综合久久婷婷香蕉 | 一二三四社区欧美黄| 天天色 色综合| 久久99国产精品久久99| youjizz国产精品| 精品视频999| 久久久久国产免费免费| 亚洲精品乱码久久久久久| 日韩高清中文字幕一区| 丁香一区二区三区| 欧美日韩免费高清一区色橹橹| 欧美精品一区二| 亚洲人成网站精品片在线观看 | 曰韩精品一区二区| 免费在线视频一区| 成人短视频下载| 欧美一区二区三区思思人| 国产午夜精品美女毛片视频| 亚洲综合色在线| 国产综合久久久久久久久久久久| 成人美女视频在线观看18| 欧美日韩国产另类不卡| 欧美经典一区二区三区| 亚洲午夜精品久久久久久久久| 国产一区二区免费在线| 欧美视频在线一区二区三区 | 亚洲最新视频在线播放| 韩国精品在线观看| 欧美午夜电影一区| 国产精品无圣光一区二区| 五月激情综合婷婷| 成人免费视频免费观看| 日韩欧美精品三级| 亚洲妇熟xx妇色黄| 99久久精品99国产精品| 精品国产99国产精品| 亚洲综合自拍偷拍| 成人久久18免费网站麻豆| 日韩一区二区影院| 一区二区三区精品在线观看| 高清日韩电视剧大全免费| 精品久久国产老人久久综合| 无吗不卡中文字幕| 色综合久久综合网欧美综合网 | 亚洲欧洲日韩在线| 激情欧美日韩一区二区| 欧美日本一区二区三区| 亚洲激情欧美激情| eeuss鲁一区二区三区| 久久精品欧美日韩精品 | 国产不卡免费视频| 亚洲精品在线观| 麻豆精品一区二区综合av| 欧美日韩在线播放三区四区| 亚洲男人都懂的| 色老综合老女人久久久| 国产精品久久久久一区| 欧美变态凌虐bdsm| 激情丁香综合五月| 久久久久久亚洲综合| 精品一区二区三区免费观看| 精品剧情v国产在线观看在线| 丝袜诱惑制服诱惑色一区在线观看| 色综合久久综合网97色综合| 中文字幕一区二区三区不卡| 懂色av一区二区夜夜嗨| 国产精品久久久久久妇女6080| 成人教育av在线| 亚洲视频精选在线| 色8久久精品久久久久久蜜 | 国产精品伦理在线| 国产91丝袜在线18| 自拍视频在线观看一区二区| 91浏览器入口在线观看| 一区二区三区在线观看视频| 欧美午夜片在线看| 免费成人在线网站| 26uuu精品一区二区在线观看| 国产精品亚洲第一| 中文字幕一区二区三区在线观看| 在线免费观看一区| 视频一区视频二区中文| 日韩欧美国产小视频| 粉嫩av一区二区三区在线播放| 国产精品久久久久久久蜜臀| 色婷婷av一区二区三区大白胸| 亚洲成av人片在线| 欧美丰满一区二区免费视频| 午夜精品久久久久久| 91精品国产91综合久久蜜臀| 五月天中文字幕一区二区| 久久亚洲二区三区| 国产成人aaa| 亚洲图片一区二区| 欧美一区二区国产|