test.cpp

来自「词法分析程序。可实现对C语言的词法分析,关键字32个,包含了C的绝大部分运算、限」· C++ 代码 · 共 65 行

CPP
65
字号
#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 + =
减小字号Ctrl + -
显示快捷键?