⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ma.cpp

📁 用C++编写的产生文章的程序
💻 CPP
字号:
// ma.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include "algorithm.h"
#include<iostream>
#include<fstream>

using std::cin ;
using std::cout;
int main(int argc,char *argv[])
{
	std::ifstream inFile;
   std::ofstream outFile;

   if (argc !=4) 
	   cout<<"格式 ma sourcefile destfile 最大单词量";
   else
      {
		inFile.open (argv[1]);
		if(inFile==NULL)
		{
			cout<<"源文件打不开";
			
		}
		else
		{
			outFile.open (argv[2]);
			if(outFile==NULL)
			  cout<<"目标文件打不开";
			else
			{
			   int nwords=atoi(argv[3]);
			   if(nwords<0)
                  cout<<"单词量必须大于0";
			   else
			   {    
				   algorithm a;
                    Prefix prefix;
				 for(int i=0;i<NPREF;i++)
					{
					 a.add(prefix,NONWORD);					
					}
             
			     a.build(prefix,inFile);
	             a.add(prefix,NONWORD);
              	 a.generate(nwords,outFile);
			   }
			}
		}
	  }
  
   const char *filename="F:\\1.txt";
   
  
  
	return 0;
}

⌨️ 快捷键说明

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