阅读背景:

c++开始和结束不工作

来源:互联网 

Here is the code :

这里是代码:

#include <iostream>
#include <fstream>
#include <algorithm>
#include <iterator>
using namespace std;

int main(int argc, char** argv)
{
  ifstream myfile (argv[1]);
  char ch;
  char operator_symbols[]={'+','-','*','<','>','&','.',
                               '@','/',':','=','~','|','$',
                               '!','#','%','^','_','[',']',
                               '{','}','\"','`','?'
                              };
  while(!myfile.eof())
    {
      myfile.get(ch);
      if(isalpha(ch))
    {
      cout << "isalpha " << ch << endl; 
    }
      else if(isdigit(ch))
    {
      cout << "is num " << ch << endl;
    }
      else if(find(begin(operator_symbols), end(operator_symbols), ch) != end(operator_symbols))
    {
      cout << "is operator sym" << ch << endl;
    }
      else if(ch == '(' || ch == ')' || ch == ';' || ch == ',')
    {
      cout << "is punctuation " << ch << endl;
    }
      else if (isspace(ch))
    {
      cout << "is space " << ch << endl;
    }
    }
}
#include <iostrea



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: