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


C++ VS::clear方法代码示例

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


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

示例1: 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

示例2: main

int main() {
	int m, n;
	int i, j, k;
	int max_subfile, max_file;
	string s, x;
	//freopen("f:\\in.txt", "r", stdin);
	while (cin >> s) {
		flist.clear();
		for (i=3; s[i]; ++i) {
			if (s[i] == '\\') flist.push_back(s.substr(0, i));
		}
		n = flist.size();
		for (i=0; i!=n; ++i) {
			if (fc.find(flist[i]) == fc.end()) {
				for (j=0; j!=i; ++j) {
					if (subfile.find(flist[j]) == subfile.end()) subfile.insert(make_pair(flist[j], 1));
					else ++subfile[flist[j]];
				}
				fc.insert(flist[i]);
			}
			if (file.find(flist[i]) == file.end()) file.insert(make_pair(flist[i], 1));
			else ++file[flist[i]];
		}
	}
	max_subfile = 0, max_file = 0;
	for (MSII it=subfile.begin(); it!=subfile.end(); ++it) max_subfile = max(max_subfile, it->second);
	for (MSII it=file.begin(); it!=file.end(); ++it) max_file = max(max_file, it->second);
	printf("%d %d\n", max_subfile, max_file);
	return 0;
}
开发者ID:delta4d,项目名称:AlgoSolution,代码行数:30,代码来源:C.cpp

示例3: main

int main(){
  int i, n; char buff[MAXL]; VS code;

  while(scanf("%d", &n) == 1){
    code.clear();
    for(i = 0; i < n; i++){
      scanf(" %s", buff);
      code.push_back(buff);
    }
    printf("[%s]\n", UDFind(code).c_str());
  }
  return 0;
}
开发者ID:AssaultKoder95,项目名称:codejam,代码行数:13,代码来源:ud_find.cpp

示例4: generateTestData

            void generateTestData(const int scenario, const int subset) {
                size_t subset_total = dataSamples.size() / subsetsNum;
                int train_start_index = subset * (int)subset_total;
                int test_start_index = train_start_index + subset_total * 0.66;
                int end_index = train_start_index + (int)subset_total;
                if (end_index > dataSamples.size()) {
                    end_index = (int)dataSamples.size();
                }
                
                //
                // prepare train data
                //
                DTrain.clear();
                double mean = 0;
                int countIq = 0;
                for (int i = train_start_index; i < test_start_index; i++) {
                    VS rows = dataSamples[i];
                    for (int r = 0; r < rows.size(); r++) {
                        string line = rows[r];
                        VS values = splt(line);
                        double iq = atof(values[iqCol].c_str());
                        
                        if (scenario > 0) {
                            DTrain.push_back(line);
                        } else if (iq > 0) {
                            // add only line with IQ set for 1 scenario
                            DTrain.push_back(line);
                        }
                        
                        if (iq > 0) {
                            mean += iq;
                            countIq++;
                        }
                    }
                }
//                filterDataSet(DTrain, scenario, true);
                
                //
                // prepare test data
                //
                DTest.clear();
                groundTruth.clear();
                for (int i = test_start_index; i < end_index; i++) {
                    VS rows = dataSamples[i];
                    for (int r = 0; r < rows.size(); r++) {
                        string line = rows[r];
                        VS values = splt(line);
                        double iq = atof(values[iqCol].c_str());
                        if (iq > 0) {
                            groundTruth.push_back(iq);
                            // add only line with IQ set for 1 scenario
                            DTest.push_back(line);
                        } else if (scenario > 0) {
                            DTest.push_back(line);
                        }
                    }
                }
//                filterDataSet(DTest, scenario, false);
                
                //
                // calculate sse0
                //
                mean /= countIq;
                sse0 = 0;
                for (const double &iq : groundTruth) {
                    double e = mean - iq;
                    sse0 += e * e;
                }
            }
开发者ID:yaricom,项目名称:childstuntedness5,代码行数:69,代码来源:TestRunner.cpp


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