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

📄 exp1.cpp

📁 编译原理实验将简单中缀算术表达式变换成后缀形式
💻 CPP
字号:
// 实验一.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "global.h"
#include <stdio.h>
#include <string.h>
FILE*fp1,*fp2;//fp输入文件指针1,fp2输出文件指针
intstack S;//定义栈
bool mode;  //判定模式-c or -s
void main(int argc, char* argv[])
{
	if(argc==1){
		msg();
	}
	else if(argc==4)
	{
    if(strcmp(argv[1],"-s")==0) 
		mode=1;
	else if (strcmp(argv[1],"-c")==0)
        mode=0;
	else
		error2("commond error");
	InitStack(S);
	if((fp1=fopen(argv[2],"r"))==NULL)
		error2("cannot open input file");
	if((fp2=fopen(argv[3],"w"))==NULL)
		error2("cannot open output file");	 
	init();
	parse();
	exit(0);
	}
	else
	{
		printf("输入格式不正确\n");
		msg();
	}
}

⌨️ 快捷键说明

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