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


C++ ifstream::unsetf方法代码示例

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


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

示例1: readFile

 void Indentation::readFile(ifstream &inp)
    {int i;
    inp.unsetf(ios::skipws); //include white space in read
        for(i=0;!inp.eof();i++)
        inp>>store[i];
        numofchar=i-1;
    }
开发者ID:harshapps,项目名称:NITWCSE-programs,代码行数:7,代码来源:Indentation.cpp

示例2: sprawdz_baze

size_t sprawdz_baze(ifstream &baza_pytan){
    if( !baza_pytan.good() )  {cout << "bazaZla\n"; return -1;}
    baza_pytan.clear();
    baza_pytan.seekg(0, ios::beg);
    baza_pytan.unsetf(std::ios_base::skipws);
    size_t line_count = count(istream_iterator<char>(baza_pytan),istream_iterator<char>(), '\n');
    baza_pytan.clear();
    baza_pytan.seekg(0,ios::beg);
    return line_count;
}
开发者ID:murnko,项目名称:autoscore,代码行数:10,代码来源:funkcje.cpp

示例3: process

void process(ifstream &icin, int type) //预处理一个标号为type_id的文档
{
    doc_count[type]++;
    map<int, int> count;
    int m = 0;
    char ch;
    string now="";
    icin.unsetf(ios::skipws);
    while (icin>>ch)
    {
        if (valid(ch)) now+=ch;
        else
        {
            if (now!="") insert(m, count, now);
            now="";
        }
    }
    if (now!="") insert(m, count, now);
    printf("%d ",type);
    for (map<int,int>::iterator it = count.begin(); it != count.end(); it++)
        printf(" %d:%lf", it->first, it->second*1.0/m);
    printf("\n");
}
开发者ID:lixueclaire,项目名称:LR-documents-classifier,代码行数:23,代码来源:process.cpp

示例4: main

int main ()
{
    
  fOut.open ( "6assign.out", ios::out );
  if ( !fOut )
    {
      cerr << "Can't open file." << endl;
      exit (-1); // Stops program if can't open file 6assign.out
    }
   
  const int MAX_SIZE = 30;
  char inFileName[MAX_SIZE];
  
  const int MAX_INPUT_SIZE = 100;
  double a[MAX_INPUT_SIZE];
   
  cout << "Input file name(s) separated by one space: ";
  cin.get ( inFileName, MAX_SIZE );

  cout << "Data will be read from: " << inFileName << endl;
  
  // Get data from input file
  fIn.open ( inFileName, ios::in );  
  fIn.unsetf ( ios::skipws );

  if ( !fIn )
    {
      cerr << "Can't open input file." << endl;
      exit (-1);
    }
  
  

  

  // Print standard header information
  ShowHeader ( fOut );


  
  
  // Calls function that calculates mininum, maxinimum and averave values
  //MaxMinAve ( a, MAX_INPUT_SIZE );

  // Call function that will read in the arrray
  //readArray ( a, MAX_INPUT_SIZE )
  
  // Call findMin function for minimum value
  Min1 = findMin ( a, MAX_INPUT_SIZE );
  fOut << "The minimum is: " << Min1 << endl;
 
  // Call findMax function for maximum value
  Max1 = findMax ( a, MAX_INPUT_SIZE );
  fOut << "The maximum is: " << Max1 << endl;

  // Call calAve function for average value
  Ave1 = calAve ( a, MAX_INPUT_SIZE );
  fOut << "The average is: " << Ave1 << endl;

  // Call function that calculates the standard deviation
  stDev1 = CalStandDev ( a, MAX_INPUT_SIZE );
  fOut << "The standard deviation is: " << stDev1 << endl;
  

  // Close the input file
  fIn.close();
  
  // Close the output file
  fOut.close();



  return 0;

}
开发者ID:ccasey645,项目名称:OldMachine,代码行数:75,代码来源:assign6.cpp


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