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

📄 check.cpp

📁 检查一个C语言源程序的配对情况,如有不配对的情况 则说明具体位置
💻 CPP
字号:
#include "Check.h"
void main()
{
	char name[20],ch;
	int row=1;
	ifstream infile;
	CCheck* sign;
	cout<<"Please enter the name of the file:    ";
	cin>>name;
	infile.open(name);
	infile.get(ch);
	while(infile)
	{
		switch(ch)
		{
		case '(':
		case '[':
		case '{':
			sign=new CCheck(ch,row);
			if(!sign->IsOK(infile))
				cout<<"第"<<sign->m_row<<"行"<<ch<<"配对失败"<<endl;
				row=sign->row;
			break;
		case ']':
		case ')':
		case '}':
			cout<<"第"<<row<<"行"<<ch<<"配对失败"<<endl;
			break;
		case '\n':
			row++;
		}
		infile.get(ch);
	}
	infile.close();
	cout<<"分析完成"<<endl;
}











































































⌨️ 快捷键说明

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