这篇教程C++ words函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中words函数的典型用法代码示例。如果您正苦于以下问题:C++ words函数的具体用法?C++ words怎么用?C++ words使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了words函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: _andstd::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,
示例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,
示例3: resetvoid 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,
示例4: wordsbool 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,
示例5: wordsvoid 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,
示例6: FindWordstd::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,
示例7: words// Compile code in boot image so that we can execute the startup quotation// Allocates memoryvoid 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,
示例8: wordsCString 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,
示例9: EnsureEnsure(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,
示例10: wordssize_tUTF8StrChrFieldSearcher::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,
示例11: chooseWordsstd::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,
示例12: wordsvoid 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,
示例13: mainvoid 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,
示例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,
示例15: wordsvector<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,
示例16: SASSERTvoid mpfx_manager::allocate(mpfx & n) { SASSERT(n.m_sig_idx == 0); unsigned sig_idx = m_id_gen.mk(); ensure_capacity(sig_idx); n.m_sig_idx = sig_idx; SASSERT(::is_zero(m_total_sz, words(n)));}
开发者ID:therealoneisneo,项目名称:Z3,代码行数:7,
示例17: set_corevoid mpfx_manager::set_core(mpfx & n, mpq_manager<SYNCH> & m, mpq const & v) { if (m.is_int(v)) { set_core(n, m, v.numerator()); } else { allocate_if_needed(n); _scoped_numeral<mpz_manager<SYNCH> > tmp(m); n.m_sign = is_neg(n); m.mul2k(v.numerator(), 8 * sizeof(unsigned) * m_frac_part_sz, tmp); m.abs(tmp); if ((n.m_sign == 1) != m_to_plus_inf && !m.divides(v.denominator(), tmp)) { m.div(tmp, v.denominator(), tmp); m.inc(tmp); } else { m.div(tmp, v.denominator(), tmp); } m_tmp_digits.reset(); m.decompose(tmp, m_tmp_digits); unsigned sz = m_tmp_digits.size(); if (sz > m_total_sz) throw overflow_exception(); unsigned * w = words(n); ::copy(sz, m_tmp_digits.c_ptr(), m_total_sz, w); } SASSERT(check(n));}
开发者ID:therealoneisneo,项目名称:Z3,代码行数:27,
示例18: overflow_exceptionvoid mpfx_manager::set(mpfx & n, uint64 v) { if (m_int_part_sz == 1) { if (v > static_cast<uint64>(UINT_MAX)) throw overflow_exception(); } if (v == 0) { reset(n); } else { allocate_if_needed(n); n.m_sign = 0; unsigned * _v = reinterpret_cast<unsigned*>(&v); unsigned * w = words(n); for (unsigned i = 0; i < m_total_sz; i++) w[i] = 0; w[m_frac_part_sz] = _v[0]; if (m_int_part_sz == 1) { SASSERT(_v[1] == 0); } else { w[m_frac_part_sz+1] = _v[1]; } } SASSERT(is_int(n)); SASSERT(get_uint64(n) == v); SASSERT(check(n));}
开发者ID:therealoneisneo,项目名称:Z3,代码行数:28,
示例19: worker_threadvoid* worker_thread(void* arg){ thread_data *TData; TData=(thread_data *) arg; TData->dict=words(TData); pthread_exit(NULL);}
开发者ID:GarritMan,项目名称:hw2,代码行数:7,
示例20: wordsQStringQvisSessionSourceChangerDialog::SplitPrompt(const QString &s) const{ static const int MAX_PROMPT_LENGTH = 60; if(s.length() < MAX_PROMPT_LENGTH) return s; else { stringVector words(SplitValues(std::string(s.toStdString()), ' ')); QString r; size_t len = 0; for(size_t i = 0; i < words.size(); ++i) { if(len > 0) r += " "; r += QString(words[i].c_str()); len += words[i].size(); if(len >= (size_t)MAX_PROMPT_LENGTH) { r += "/n"; len = 0; } } return r; }}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:26,
示例21: findLadders vector<vector<string> > findLadders(string start, string end, curset &dict) { init(dict); vector<string> words(dict.begin(), dict.end()); for (unsigned int i = 0; i < words.size(); i ++) wordsMap[words[i]] = i; for (int i = 0; i < words.size(); i ++) { string currWord = words[i]; for (int j = 0; j < words[i].length(); j ++) { for (char k = 'a'; k <= 'z'; k ++) { if (words[i][j] == k) continue; currWord[j] = k; if (dict.find(currWord) != dict.end()) linkedList[i].push_back(wordsMap[currWord]); } currWord[j] = words[i][j]; } } int offset = bfs(wordsMap[start], wordsMap[end]); if (offset == INT32_MAX) return ans; path.resize(offset + 1); dfs(offset, wordsMap[end], wordsMap[start]); for (int i = 0; i < ansPath.size(); i ++) { vector<string> p; for (int j = 0; j < ansPath[i].size(); j ++) { p.push_back(words[ansPath[i][j]]); } ans.push_back(p); } return ans; }
开发者ID:Suninus,项目名称:InterviewPuzzle,代码行数:35,
示例22: wordsdouble InputEvent::trueWordsPerMinute() const{ if(!m_processed) return 0; if(m_numWords == 0) words(); return (double)m_numWords/m_counts.totalTime*60000;}
开发者ID:jimhester,项目名称:TypeTracker,代码行数:8,
示例23: reverseWords void reverseWords(string &s) { istringstream words(s); string word, res; while(words >> word) res = word + " " + res; if(!res.empty()) res.pop_back(); s = res; }
开发者ID:iXuZhang,项目名称:Practice,代码行数:8,
示例24: stopWordsconst HashSet<String> RussianAnalyzer::getDefaultStopSet() { static HashSet<String> stopSet; if (!stopSet) { String stopWords(UTF8_TO_STRING(DEFAULT_STOPWORD_FILE)); Collection<String> words(StringUtils::split(stopWords, L"/n")); stopSet = HashSet<String>::newInstance(words.begin(), words.end()); } return stopSet;}
开发者ID:304471720,项目名称:LucenePlusPlus,代码行数:9,
示例25: QWidget/** * Constructor of the AddGroupWindow class, generating its window. * @param favorites List of favorites tags, needed for coloration * @param parent The parent window */AddGroupWindow::AddGroupWindow(QString selected, QStringList sites, QStringList favorites, QWidget *parent) : QWidget(parent), m_sites(sites){ QVBoxLayout *layout = new QVBoxLayout; QFormLayout *formLayout = new QFormLayout; m_comboSites = new QComboBox; m_comboSites->setMaxVisibleItems(20); m_comboSites->addItems(m_sites); m_comboSites->setCurrentIndex(m_sites.indexOf(selected)); formLayout->addRow(tr("&Site"), m_comboSites); m_lineTags = new TextEdit(favorites, this); m_lineTags->setContextMenuPolicy(Qt::CustomContextMenu); QStringList completion; QFile words("words.txt"); if (words.open(QIODevice::ReadOnly | QIODevice::Text)) { while (!words.atEnd()) { QByteArray line = words.readLine(); completion.append(QString(line).remove("/r/n").remove("/n").split(" ", QString::SkipEmptyParts)); } QCompleter *completer = new QCompleter(completion, this); completer->setCaseSensitivity(Qt::CaseInsensitive); m_lineTags->setCompleter(completer); } formLayout->addRow(tr("&Tags"), m_lineTags); m_spinPage = new QSpinBox; m_spinPage->setRange(1, 1000); m_spinPage->setValue(1); formLayout->addRow(tr("&Page"), m_spinPage); m_spinPP = new QSpinBox; m_spinPP->setRange(1, 1000); m_spinPP->setValue(1000); formLayout->addRow(tr("&Images par page"), m_spinPP); m_spinLimit = new QSpinBox; m_spinLimit->setRange(1, 1000000); m_spinLimit->setValue(1000); formLayout->addRow(tr("&Limite d'images"), m_spinLimit); m_comboDwl = new QComboBox; m_comboDwl->setMaxVisibleItems(20); m_comboDwl->addItems(QStringList() << tr("Oui") << tr("Non")); m_comboDwl->setCurrentIndex(1); formLayout->addRow(tr("&Télécharger les image de la liste noire"), m_comboDwl); layout->addLayout(formLayout); QHBoxLayout *layoutButtons = new QHBoxLayout; QPushButton *buttonOk = new QPushButton(tr("Ok")); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ok())); layoutButtons->addWidget(buttonOk); QPushButton *buttonClose = new QPushButton(tr("Fermer")); connect(buttonClose, SIGNAL(clicked()), this, SLOT(close())); layoutButtons->addWidget(buttonClose); layout->addLayout(layoutButtons); this->setLayout(layout); this->setWindowIcon(QIcon(":/images/icon.ico")); this->setWindowTitle(tr("Ajouter groupe")); this->setWindowFlags(Qt::Window); this->resize(QSize(400, 0));}
开发者ID:ExKia,项目名称:imgbrd-grabber,代码行数:62,
示例26: NumericTimebool NumericTime(const char *text, int *hour, int *min, int *sec) { int textlen = strlen(text); StringWordIter words(StringPiece(text, textlen), isint<':'>); *hour = atoi(IterNextString(&words)); *min = atoi(IterNextString(&words)); *sec = atoi(IterNextString(&words)); if (textlen >= 2 && !strcmp(text+textlen-2, "pm") && *hour != 12) *hour += 12; return true;}
开发者ID:marccodes,项目名称:lfl,代码行数:9,
示例27: SplitTest2void SplitTest2(){ std::string s = "Hello my baby!"; std::istringstream iss(s); std::istream_iterator<std::string> beg(iss), end; std::vector<std::string> words(beg, end); for(auto & w : words) std::cout << w << std::endl;}
开发者ID:elixir67,项目名称:Sandbox,代码行数:9,
注:本文中的words函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ work函数代码示例 C++ wordfree函数代码示例 |