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


C++ VS类代码示例

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


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

示例1: main

void main()
{
	string strWord,strKey;int i;MSVS msvsDictionary;
	while(cin>>strWord)
	{
		if(strWord.compare("XXXXXX")==0)break;
		strKey=strWord;sort(strKey.begin(),strKey.end());
		if(msvsDictionary.find(strKey)==msvsDictionary.end())
		{
			VS vsList;vsList.push_back(strWord);
			msvsDictionary.insert(MSVS::value_type(strKey,vsList));
		}
		else msvsDictionary[strKey].push_back(strWord);
	}
	while(cin>>strKey)
	{
		if(strKey.compare("XXXXXX")==0)break;
		sort(strKey.begin(),strKey.end());
		if(msvsDictionary.find(strKey)==msvsDictionary.end())cout<<"NOT A VALID WORD"<<endl;
		else
		{
			sort(msvsDictionary[strKey].begin(),msvsDictionary[strKey].end());
			for(i=0;i<msvsDictionary[strKey].size();i++)
				cout<<msvsDictionary[strKey][i]<<endl;
		}
		cout<<"******"<<endl;
	}
}
开发者ID:junzh0u,项目名称:poj-solutions,代码行数:28,代码来源:2130020_AC_0MS_144K.cpp

示例2: UDFind

string UDFind(VS code){
  int i, j, n = code.size(); string t; Code c;
  set<string> s;               /* Mark tails already seen */
  priority_queue<Code> tails;  /* Keep track of current tails */

  sort(code.begin(), code.end(), cmpSS);
  s.clear();
  for(i = 0; i < n; i++) for(j = i+1; j < n; j++){
    if(code[i] == code[j]) return code[i];
    CHECK(code[i], code[j]);
    CHECK(code[j], code[i]);
  }
  s.clear();
  while(!tails.empty()){
    Code top = tails.top(); tails.pop();
    if(s.count(top.b)) continue;
    s.insert(top.b);
    for(j = 0; j < n; j++){
      if(top.b == code[j]) return top.a+top.b;
      CHECK2(top.b, code[j]);
      CHECK2(code[j], top.b);
    }
  }
  return "";
}
开发者ID:AssaultKoder95,项目名称:codejam,代码行数:25,代码来源:ud_find.cpp

示例3: calc

VS calc( VS s ) {
    Set S;
    for ( VS::iterator it_i = s.begin(); it_i != s.end(); ++ it_i ) {
        string a = *it_i;
        string b = rotate(a);
        cout << a << ", " << b << endl;
        if ( ! is_valid(a) ) {
            if ( is_valid(b) ) {
                S.insert(b);
            }
        } else if ( ! is_valid(b) ) {
            if ( is_valid(a) ) {
                S.insert(a);
            }
        } else {
            if ( S.count(a) )
                S.insert(b);
            else if ( S.count(b) )
                S.insert(a);
            else
                S.insert(min(a, b));
        }
    }
    if ( S.size() != s.size() )
        return VS();
    VS res(S.begin(), S.end());
    return res;
}
开发者ID:sh19910711,项目名称:topcoder-solutions,代码行数:28,代码来源:DateFormat.cpp

示例4: parse

VS parse(string& s) {
	VS v;
	for (int i = s.FN(' '); i < s.length(); i = s.FN(' ', i)) {
		char c = s[i];
		if (is_num(c)) {
			int j = s.FN(NUMS, i);
			if (j == string::npos) {
				v.PB(s.substr(i));
				break;
			}
			v.PB(s.substr(i, j - i));
			i = j;
		}
		else if (is_func(c)) {
			int j = s.FN(FUNS, i);
			v.PB(s.substr(i, j - i));
			i = j;
		}
		else {
			v.PB(s.substr(i, 1));
			i += 1;
		}
	}

	return v;
}
开发者ID:kevin1kevin1k,项目名称:dsa2015,代码行数:26,代码来源:3_4_2.cpp

示例5: replyVector

VS replyVector() {
    VS ret;
    return ret;
    ret.push_back("titi");
    ret.push_back("tutu");
    return ret;
}
开发者ID:hejunbok,项目名称:libqi,代码行数:7,代码来源:qiservicetestmain.cpp

示例6: main

int main()
{
    char str[100];
    while(scanf("%s",str))
    {
        int len=strlen(str);
        int ar[100];
        for( int i=0; i<len; i++ ) ar[i]=i;
        VS v;
        string st;
        sort(ar,ar+len);
        do
        {
            for( int i=0; i<len; i++ ) st+=str[ar[i]];
            v.PB(st);
            st.clear();
        }
        while(next_permutation(ar,ar+len));
        for( int i=0; i<v.size()/len; i++ )
        {
            for( int j=i; j<v.size(); j+=7 )
                cout<<v[j]<<endl;
        }
        v.clear();
        printf("\n");
    }
    return 0;
}
开发者ID:robinmbstu11,项目名称:UVA,代码行数:28,代码来源:10394_Titans+are+in+Danger.cpp

示例7: add_all_transformed

void Mesh::addQuad(float width, float height) {
  int indexOffset = positions.size();
  float x = width / 2.0f;
  float y = height / 2.0f;

  VVec4 quad;
  // C++11      { glm::vec3(-x, -y, 0), glm::vec3(x, -y, 0), glm::vec3(x, y, 0), glm::vec3(-x, y, 0),  });
  quad.push_back(glm::vec4(-x, -y, 0, 1));
  quad.push_back(glm::vec4(x, -y, 0, 1));
  quad.push_back(glm::vec4(x, y, 0, 1));
  quad.push_back(glm::vec4(-x, y, 0, 1));

  // Positions are transformed
  add_all_transformed(model.top(), positions, quad);
  if (normals.size()) {
    // normals are transformed with only the rotation, not the translation
    model.push().untranslate();
    add_all_transformed(model.top(), normals, quad);
    model.pop();
  }

  // indices are copied and incremented
  VS quadIndices;
  // C++11 VS( { 0, 1, 2, 0, 2, 3 } );
  quadIndices.push_back(0);
  quadIndices.push_back(1);
  quadIndices.push_back(2);
  quadIndices.push_back(0);
  quadIndices.push_back(2);
  quadIndices.push_back(3);
  add_all_incremented(indexOffset, indices, quadIndices);

  fillColors();
  fillNormals();
}
开发者ID:Kittnz,项目名称:OculusRiftInAction,代码行数:35,代码来源:GlMesh.cpp

示例8: convert

 VS convert( string s ) {
     VS res;
     ISS iss(s);
     string word;
     while ( iss >> word )
         res.push_back(word);
     return res;
 }
开发者ID:sh19910711,项目名称:uva-solutions,代码行数:8,代码来源:10100.cpp

示例9: play

void play(MSI& rank, VS& toks) {
	SS oprs;
	SD nums;
	string out = "";
	char str[100];

	cout << "# from infix to postfix!!!" << endl;
	
	for (VS::iterator i = toks.begin(); i != toks.end(); i++) {
		string tok = *i;
		
		cout << "There is a " << tok << ": ";

		if (is_num(tok)) {
			cout << "push to output" << endl;
			sprintf(str, "%.6lf ", stod(tok));
			out += str;
			nums.push(stod(tok));
		}
		else if (tok == ",") {
			cout << "flush the stack until '('" << endl;
			while (oprs.top() != "(")
				calc(oprs, nums, out);
		}
		else if (tok == ")") {
			cout << "flush the stack until '(' and check if there's a func" << endl;
			while (oprs.top() != "(")
				calc(oprs, nums, out);
			oprs.pop();
			if (!oprs.empty() && is_func(oprs.top()))
				calc(oprs, nums, out);
		}
		else {
			cout << "push to stack" << endl;
			if ( is_unary(tok) && (i == toks.begin() || rank[*(i - 1)] > 0) )
				oprs.push("u" + tok);
			else { 
				while (!is_func(tok) && tok != "(" && !oprs.empty() && rank[oprs.top()] <= rank[tok]) {
					cout << "\t*** stack.top() has higher precedence" << endl;
					calc(oprs, nums, out);
				}
				oprs.push(tok);
			}
		}

		cout << "\tcurrent output: " << out << endl
			 << "\tcurrent  stack: " << oprs << endl;
	}

	while (!oprs.empty())
		calc(oprs, nums, out);

	cout << "There is nothing left, so flush the stack to output" << endl
		 << "\tcurrent output: " << out << endl
		 << "#transformation completed!!!" << endl
		 << "Postfix Exp: " << out << endl
		 << "RESULT: " << nums.top() << endl << endl;
}
开发者ID:kevin1kevin1k,项目名称:dsa2015,代码行数:58,代码来源:3_4_2.cpp

示例10: convert

string convert( VS list ) {
    OSS oss;
    for ( VS::iterator it_i = list.begin(); it_i != list.end(); ++ it_i ) {
        oss << *it_i;
        if ( it_i + 1 != list.end() )
            oss << " ";
    }
    return oss.str();
}
开发者ID:sh19910711,项目名称:topcoder-solutions,代码行数:9,代码来源:DateFormat.cpp

示例11: parse

VS parse(string s)
{
  string a;
  VS wyn;
  REP(i,(int)s.size())
    if (s[i]!=' ') a+=s[i];
    else if (!a.empty()) { wyn.PB(a); a=""; }
  if (!a.empty()) wyn.PB(a);
  return wyn;
}
开发者ID:alfieb,项目名称:Facebook-Hacker-Cup-Results,代码行数:10,代码来源:16.cpp

示例12:

ostream& operator<<(ostream& out, const SS& s) {
	VS v;
	SS ss = s;
	while (!ss.empty()) {
		v.PB(ss.top());
		ss.pop();
	}
	for (int i = v.size() - 1; i >= 0; i--)
		out << v[i] << ' ';
	return out;
}
开发者ID:kevin1kevin1k,项目名称:dsa2015,代码行数:11,代码来源:3_4_2.cpp

示例13: split

inline VS split(string s,char* tok) {
    VS vs;
    char *pch;
    char *q= (char*)s.c_str();
    pch=strtok(q," ");
    while(pch !=NULL) {
        vs.pb(string(pch));
        pch=strtok(NULL,tok);
    }
    return vs;
}
开发者ID:SwitchCase,项目名称:Problem_Solutions,代码行数:11,代码来源:10507+graph+Simulation.cpp

示例14: replyMap2

MSM replyMap2() {
    MSM ret;
    VS v;

    return ret;
    v.push_back("titi");
    v.push_back("tutu");

    ret["titi"] = v;
    ret["tutu"] = v;
    return ret;
}
开发者ID:hejunbok,项目名称:libqi,代码行数:12,代码来源:qiservicetestmain.cpp

示例15: split

VS split( string s, string c )
{
  VS ret;
  for( int i=0, n; i <= s.length(); i=n+1 ){

    n = s.find_first_of( c, i );
    if( n == string::npos ) n = s.length();
    string tmp = s.substr( i, n-i );
    ret.push_back(tmp);
  }
  return ret;
}
开发者ID:vitroid,项目名称:CageIntegral,代码行数:12,代码来源:histogram.cpp


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