当前位置: 首页>>代码示例>>C++>>正文


C++ words函数代码示例

本文整理汇总了C++中words函数的典型用法代码示例。如果您正苦于以下问题:C++ words函数的具体用法?C++ words怎么用?C++ words使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了words函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _and

std::string EnglishSpelling::spell(int number)
{
	int n = number;

	return boost::trim_copy(words(n / 1000000, " million " + _and (n % 1000000)) +
		words((n % 1000000) / 1000, " thousand " + _and (n % 1000)) + words(n % 1000, ""));
}
开发者ID:jer0Me,项目名称:ItRules,代码行数:7,代码来源:EnglishSpelling.cpp

示例2: remove

    bool remove(uint element) {
      uint word_index = IndexSet::get_word_index(element);
      uint bit_index = IndexSet::get_bit_index(element);

      uint32 bit = (0x1 << bit_index);
      uint32 before = words()[word_index];
      words()[word_index] = before & ~bit;
      return ((before & bit) != 0);
    }
开发者ID:GregBowyer,项目名称:ManagedRuntimeInitiative,代码行数:9,代码来源:indexSet.hpp

示例3: reset

void mpfx_manager::set(mpfx & n, mpfx const & v) {
    if (is_zero(v)) {
        reset(n);
        return;
    }
    allocate_if_needed(n);
    n.m_sign      = v.m_sign;
    unsigned * w1 = words(n);
    unsigned * w2 = words(v);
    for (unsigned i = 0; i < m_total_sz; i++)
        w1[i] = w2[i];
    SASSERT(check(n));
}
开发者ID:therealoneisneo,项目名称:Z3,代码行数:13,代码来源:mpfx.cpp

示例4: words

bool mpfx_manager::eq(mpfx const & a, mpfx const & b) const {
    if (is_zero(a) && is_zero(b))
        return true;
    if (is_zero(a) || is_zero(b))
        return false;
    if (a.m_sign     != b.m_sign) 
        return false;
    unsigned * w1 = words(a);
    unsigned * w2 = words(b);
    for (unsigned i = 0; i < m_total_sz; i++) 
        if (w1[i] != w2[i])
            return false;
    return true;
}
开发者ID:therealoneisneo,项目名称:Z3,代码行数:14,代码来源:mpfx.cpp

示例5: words

void words(char *arr){
	//base case 1
	if (!(*arr))
		return;
	//base case 2
	if (*arr==' '){
		printf("\n");
		words(arr+1);
	}
	else {	
		printf("%c",*arr);
		words(arr+1);
	}
}
开发者ID:wayneiny,项目名称:algo,代码行数:14,代码来源:words.c

示例6: FindWord

std::string FindWord(const trie_type& trie, const std::string& keys, size_t alternative)
{
    typedef std::vector<Word>   Words;

    trie_type::result_type candidates = trie.find(keys);
    
    Words::const_iterator match;
    Words words(candidates.first, candidates.second);
    std::sort(words.begin(), words.end(), boost::mem_fn(&Word::MoreFrequent));

    for (Words::const_iterator word = words.begin(); word != words.end(); ++word)
    {
        match = word;

        if (alternative == 0)
        {
            break;
        }
        else
        {
            --alternative;
        }
    }

    if (match == words.end())
    {
        return "No alternative";
    }
    else
    {
        return match->str();
    }
}
开发者ID:kevinclark,项目名称:kata,代码行数:33,代码来源:main.cpp

示例7: words

// Compile code in boot image so that we can execute the startup quotation
// Allocates memory
void factor_vm::prepare_boot_image() {
  std::cout << "*** Stage 2 early init... " << std::flush;

  // Compile all words.
  data_root<array> words(instances(WORD_TYPE), this);

  cell n_words = array_capacity(words.untagged());
  for (cell i = 0; i < n_words; i++) {
    data_root<word> word(array_nth(words.untagged(), i), this);

    FACTOR_ASSERT(!word->entry_point);
    jit_compile_word(word.value(), word->def, false);
  }
  update_code_heap_words(true);

  // Initialize all quotations
  data_root<array> quotations(instances(QUOTATION_TYPE), this);

  cell n_quots = array_capacity(quotations.untagged());
  for (cell i = 0; i < n_quots; i++) {
    data_root<quotation> quot(array_nth(quotations.untagged(), i), this);

    if (!quot->entry_point)
      quot->entry_point = lazy_jit_compile_entry_point();
  }

  special_objects[OBJ_STAGE2] = special_objects[OBJ_CANONICAL_TRUE];

  std::cout << "done" << std::endl;
}
开发者ID:AlexIljin,项目名称:factor,代码行数:32,代码来源:factor.cpp

示例8: words

CString CSub::GetFileNameFromPath(CString path)
{
    CStringList words(10);
    Split("\\", m_NameOfFile, words);
    CString filename = words.GetAt(words.FindIndex(words.GetCount() - 1)) ;
    return filename;
}
开发者ID:dogshoes,项目名称:map-n-zap,代码行数:7,代码来源:Sub.cpp

示例9: Ensure

Ensure(Words, invokes_callback_for_each_word_in_a_phrase) {
    expect(mocked_callback, when(word, is_equal_to_string("Birds")));
    expect(mocked_callback, when(word, is_equal_to_string("of")));
    expect(mocked_callback, when(word, is_equal_to_string("a")));
    expect(mocked_callback, when(word, is_equal_to_string("feather")));
    words("Birds of a feather", &mocked_callback, NULL);
}
开发者ID:hean01-cendio,项目名称:cgreen,代码行数:7,代码来源:words_tests4.c

示例10: words

size_t
UTF8StrChrFieldSearcher::matchTerms(const FieldRef & f, const size_t mintsz)
{
    (void) mintsz;
    termcount_t words(0);
    const byte * n = reinterpret_cast<const byte *> (f.data());
    const byte * e = n + f.size();
    if (f.size() >= _buf->size()) {
        _buf->reserve(f.size() + 1);
    }
    cmptype_t * fn = &(*_buf.get())[0];
    size_t fl(0);

    for( ; n < e; ) {
        if (!*n) { _zeroCount++; n++; }
        n = tokenize(n, _buf->capacity(), fn, fl);
        for(QueryTermList::iterator it=_qtl.begin(), mt=_qtl.end(); it != mt; it++) {
            QueryTerm & qt = **it;
            const cmptype_t * term;
            termsize_t tsz = qt.term(term);
            if ((tsz <= fl) && (prefix() || qt.isPrefix() || (tsz == fl))) {
                const cmptype_t *tt=term, *et=term+tsz;
                for (const cmptype_t *fnt=fn; (tt < et) && (*tt == *fnt); tt++, fnt++);
                if (tt == et) {
                    addHit(qt, words);
                }
            }
        }
        words++;
    }
    NEED_CHAR_STAT(addAnyUtf8Field(f.size()));
    return words;
}
开发者ID:songhtdo,项目名称:vespa,代码行数:33,代码来源:utf8strchrfieldsearcher.cpp

示例11: chooseWords

std::set<std::string> chooseWords(std::string secret)
{
	// Initialise word list
	WordList words(wordLength);

	// Create a set to hold the list of options
	std::set<std::string> options;

	// Put the secret word in the set
	options.insert(secret);

	int likeWords = 0;
	while (options.size() < numberOfWords)
	{
		std::string word = words.getRandomWord();

		// Ensure that the minimum number of words are like
		if (likeWords < guaranteedNumberOfLikeWords)
		{
			int likeness = checkLikeness(word, secret);

			// They are like if more than half of the letters match the secret
			if (likeness > wordLength / 2)
			{
				options.insert(word);
				likeWords++;
			}

		}
		else
			options.insert(word);
	}

	return options;
}
开发者ID:NecroReindeer,项目名称:comp110-worksheet-4,代码行数:35,代码来源:TerminalHacking.cpp

示例12: words

void listElements::tableInsert(unordered_map<string, vector<size_t>>& uMAP, const string& str, size_t idx)
{
	vector<string> words(1, str);
	string diver = " /-";
	for (size_t i = 0, j, pivot = 0; i <= str.size(); i++)
	{
		if (i == str.size())
		{
			words.push_back(str.substr(pivot, i - pivot));
			break;
		}
		for (j = 0; j < diver.size(); j++)
			if (str[i] == diver[j])
				break;
		if (j - diver.size())
		{
			words.push_back(str.substr(pivot, i - pivot));
			pivot = i + 1;
			i++;
		}
	}
	std::sort(words.begin(), words.end());
	words.erase(unique(words.begin(), words.end()), words.end());
	for (string s : words)
		for (size_t i = 1, j; i <= s.size(); i++)
		{
			for (j = 0; j < diver.size(); j++)
				if (s[i - 1] == diver[j])
					break;
			if (j == diver.size())
				tableInsertString(uMAP, s.substr(0, i), idx);
		}
}
开发者ID:MaybeS,项目名称:ITE1009,代码行数:33,代码来源:musicList.cpp

示例13: main

void main()
{
clrscr();
int choice;
char ch;
do{clrscr();
cout<<"\n MENU ";
cout<<"\n 1.CREATE";
cout<<"\n 2.DISPLAY";
cout<<"\n 3.NO OF UPPER CASE CHARACTERS ";
cout<<"\n 4.NO OF VOWELS";
cout<<"\n 5.NO OF DIGITS";
cout<<"\n 6.NO OF WORDS";
cout<<"\n 7.NUMBER OF LINES";
cout<<"\n enter ur choice";
cin>>choice;
switch(choice)
{
case 1:create();break;
case 2:display();break;
case 3:uppercase();break;
case 4:vowels();break;
case 5:digits();break;
case 6:words();break;
case 7:lines();break;
default: cout<<"\n wrong choice entered..!!";
}
cout<<"\n do you want to continue...??";
cin>>ch;
}
while(ch=='y'||ch=='Y');
}
开发者ID:raghavjajodia,项目名称:SchoolProgramming,代码行数:32,代码来源:Q21.CPP

示例14: gc

/* Allocates memory */
void factor_vm::set_profiling(bool profiling)
{
	if(profiling == profiling_p)
		return;

	profiling_p = profiling;

	/* Push everything to tenured space so that we can heap scan
	and allocate profiling blocks if necessary */
	gc();

	gc_root<array> words(find_all_words(),this);

	cell i;
	cell length = array_capacity(words.untagged());
	for(i = 0; i < length; i++)
	{
		tagged<word> word(array_nth(words.untagged(),i));
		if(profiling)
			word->counter = tag_fixnum(0);
		update_word_xt(word.value());
	}

	update_code_heap_words();
}
开发者ID:harold,项目名称:factor,代码行数:26,代码来源:profiler.cpp

示例15: words

vector<vector<DisambiguatedData> > Disambiguator::Disambiguate(
    const vector<Token>& tokens, double percentage, size_t maxNumberOfPaths
    , vector<double>* hypothesisDistribution)
{
    vector<PredisambiguatedData> predisambiguated
        = featureCalculator->CalculateFeatures(tokens);
    // Create chain
    size_t size = predisambiguated.size();
    vector<wstring> words(size);
    vector<vector<wstring> > features(size);
    vector<wstring> labels(size);
    for (size_t chainIndex = 0; chainIndex < size; ++chainIndex)
    {
        words[chainIndex] = predisambiguated[chainIndex].content;
        features[chainIndex] = predisambiguated[chainIndex].features;
    }
    LinearCRF::Chain chain(
        std::move(words)
        , std::move(features)
        , std::move(labels)
        , vector<vector<wstring> >());

    vector<vector<wstring> > bestSequences;
    vector<vector<double> > bestSequenceWeights;
    this->Apply(chain
                , percentage
                , maxNumberOfPaths
                , &bestSequences
                , &bestSequenceWeights
                , hypothesisDistribution);

    vector<vector<DisambiguatedData> > topDisambiguatedSequences;
    for (size_t chainIndex = 0; chainIndex < bestSequences.size()
            ; ++chainIndex)
    {
        vector<DisambiguatedData> disambiguatedData;
        for (size_t tokenIndex = 0; tokenIndex < size; ++tokenIndex)
        {
            wstring& label = bestSequences[chainIndex][tokenIndex];
            shared_ptr<Morphology> grammInfo = getBestGrammInfo(
                                                   predisambiguated[tokenIndex], label);
            applyPostprocessRules(&label, grammInfo);
            const wstring& lemma
                = dictionary == 0 ? DICT_IS_NULL
                  : *(grammInfo->lemma) == NOT_FOUND_LEMMA
                  ? Tools::ToLower(predisambiguated[tokenIndex].content) : *(grammInfo->lemma);
            disambiguatedData.emplace_back(
                predisambiguated[tokenIndex].content
                , predisambiguated[tokenIndex].punctuation
                , predisambiguated[tokenIndex].source
                , predisambiguated[tokenIndex].isNextSpace
                , lemma
                , label
                , bestSequenceWeights[chainIndex][tokenIndex]
                , grammInfo->lemma_id);
        }
        topDisambiguatedSequences.push_back(std::move(disambiguatedData));
    }
    return topDisambiguatedSequences;
}
开发者ID:Samsung,项目名称:veles.nlp,代码行数:60,代码来源:Disambiguator.cpp


注:本文中的words函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。