91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡(jiǎn)介

字符串統(tǒng)計(jì)函數(shù),統(tǒng)計(jì)不同字符個(gè)數(shù)和每個(gè)字符出現(xiàn)的次數(shù)。用一個(gè)簡(jiǎn)單的數(shù)據(jù)結(jié)構(gòu)做的,注釋很清楚。

資源截圖

代碼片段和文件信息

//?CharStatistics.cpp?:?Defines?the?entry?point?for?the?console?application.
//
/*
Date2009.6.25
By?:summon
Vervion:?v1.0
Fun:?統(tǒng)計(jì)一個(gè)字符串中不同字符的個(gè)數(shù)和每種字符出現(xiàn)的次數(shù)
Time?complexity:?O(n*m)n表示字符個(gè)數(shù),m表示不相同的字符的個(gè)數(shù)
Space?complexity:?O(2*n?+1)n表示字符的個(gè)數(shù)
*/
#include?“stdafx.h“
#include?
#include?
#include?

#define?MAX_LEN?100//能夠記錄的最大的不相同的字符個(gè)數(shù)
typedef?struct?
{
int?ch[MAX_LEN];//存儲(chǔ)各不相同的字符
int?count[MAX_LEN];//對(duì)應(yīng)記錄各個(gè)不同字符出現(xiàn)的次數(shù)
int?pos;//最后不為‘\0‘的元素位置
}storage;

void?CharStat(const?char?*pchDest?storage?&stor);

int?main(int?argc?char*?argv[])
{
char?pInput[MAX_LEN]?=?{0};
printf(“Input?a?string!\n“);
gets(pInput);

storage?stor;//inint
stor.pos?=?-1;//記錄位置的初始值為-1
????for?(int?i=0;?i {
stor.ch[i]?=?0;
stor.count[

?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----

?????文件???????2100??2009-06-25?19:35??CharStatistics.cpp

-----------?---------??----------?-----??----

?????????????????2100????????????????????1


評(píng)論

共有 條評(píng)論

相關(guān)資源