edit.cpp

来自「这是本人精心搜集的关于常用图论算法的一套源码」· C++ 代码 · 共 27 行

CPP
27
字号
#include "Edit.h"
#include <stdlib.h>
void main(int argc, char *argv[]) // count, values of command-line arguments
/* Pre: Names of input and output files are given as command-line arguments.
Post: Reads an input file that contains lines (character strings), performs simple
editing operations on the lines, and writes the edited version to the output file.
Uses: methods ofclass Editor */
{ if(argc != 3)
   { cout << "Usage:\n\t edit inputfile_outputfile" << endl;
      exit (1);
    }
 ifstream file_in(argv[1]);   // Declare and open the input stream.
 if(file_in == 0)
   { cout << "Can't open input file "<<argv[1]<<endl;
      exit(1);
   }
 ofstream file_out(argv[2]);    // Declare and open the output stream.
 if(file_out == 0)
   { cout << "Can't open output file " << argv[2] << endl;
     exit (1);
   }
 Editor buffer(file_in, file_out);
 while(buffer.get_command( ))
       buffer.run_command( );
 file_in.close();    file_out.close();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?