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

📄 test.cpp

📁 词法分析程序。可实现对C语言的词法分析,关键字32个,包含了C的绝大部分运算、限界符,主要是对文件进行读、写操作,节省内存消耗,是一个不错的词法分析程序。
💻 CPP
字号:
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
/*
struct word 
{
	string name;
	word *next;
};
word *w=NULL;
word *add(word *w,string a)
{
	word *p=w;
	w=new word;
	word *s=new word;
	s->name=a;
	s->next=NULL;
	if(p==NULL)
	{
		w=s;
	}
	return(w);

}
void print(word *w)
{
	word *p;
	p=w;
	if(p==NULL){cout<<"no link."<<endl;return;}
	while(p)
	{
		cout<<p->name<<endl;
		p=p->next;
	}
}
*/
void main()
{
	fstream infile;
	fstream outfile;
	infile.open("a.txt",ios::in);
	outfile.open("b.txt",ios::out);
	char x;
	infile.get(x);
	while(!infile.eof())
	{
		
		outfile.put(x);
		infile.get(x);
	}
	
/*
	string a="123";
	w=add(w,a);
	print(w);

*/
/*	string x;
	fstream file;
	file.open("a.txt",ios::in);
	file>>x;
	cout<<x;
	*/
}

⌨️ 快捷键说明

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