本文整理汇总了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;
}
}
示例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 "";
}
示例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;
}
示例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;
}
示例5: replyVector
VS replyVector() {
VS ret;
return ret;
ret.push_back("titi");
ret.push_back("tutu");
return ret;
}
示例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;
}
示例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();
}
示例8: convert
VS convert( string s ) {
VS res;
ISS iss(s);
string word;
while ( iss >> word )
res.push_back(word);
return res;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}