0x79BEE906 (ucrtbased.dll) (ConsoleApplication1.exe 中)处有未经处理的异常: 将一个无效参数传递给了将无效参数视为严重错误的函数。
下面是源码:
#pragma warning(disable:4996)
#include <iostream>
#include <string>
using namespace std;
string key[6] = { "begin", "if", "then", "while", "do", "end" };
//关键字
bool isKey(string str, int &syn) //判断是否为关键字,若是传回相应关键码的种别名
{
int i;
for (i = 0; i < 6; i++)
{
if (str == key[i])
{
syn = i + 1;
return true;
}
}
return false;
}
bool isLetter(char c) //是否为字母
{
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))
return true;
else
return false;
}
bool isDigit(char c) //是否为数字
{
if (c >= '0' && c <= '9')
return true;
else
return false;
}
void analyse(FILE *fileP)
{
int n;
char c;
string str = "";
while ((c = fgetc(fileP)) != EOF)
{
if (c == ' ' || c == '\n' || c == '\t')
continue;
else if (isDigit(c)) //数字
{
while (isDigit(c))
{
str += c;
c = fgetc(fileP);
}
fseek(fileP, -1, SEEK_CUR);
cout << "(11, " << str << ")" << endl;
str = "";
}
else if (isLetter(c)) //字母开头的
{
while (isDigit(c) || isLetter(c))
{
str += c;
c = fgetc(fileP);
}
fseek(fileP, -1, SEEK_CUR);
if (isKey(str, n))
cout << "(" << n << ", " << str << ")" << endl; //关键码
else
cout << "(10, " << "\'" << str << "\'" << ")" << endl; //标志符
str = "";
}
else //操作符等
{
switch (c)
{
case '+':
cout << "(13, +)" << endl;
break;
case '-':
cout << "(14, -)" << endl;
break;
case '*':
cout << "(15, *)" << endl;
break;
case '/':
cout << "(16, /)" << endl;
break;
case ':':
{
if (c = fgetc(fileP) == '=')
cout << "(18, :=)" << endl;
else
{
cout << "(17, :)" << endl;
fseek(fileP, -1, SEEK_CUR);
}
break;
}
case '<':
{
c = fgetc(fileP);
if (c == '=')
cout << "(22, <=)" << endl;
else if (c == '>')
cout << "(21, <>)" << endl;
else
{
cout << "(20, <)" << endl;
fseek(fileP, -1, SEEK_CUR);
}
break;
}
case '>':
{
c = fgetc(fileP);
if (c == '=')
cout << "(24, >=)" << endl;
else
{
cout << "(23, >)" << endl;
fseek(fileP, -1, SEEK_CUR);
}
break;
}
case '=':
cout << "(25, =)" << endl;
break;
case ';':
cout << "(26, ;)" << endl;
break;
case '(':
cout << "(27, ()" << endl;
break;
case ')':
cout << "(28, ))" << endl;
break;
case '#':
cout << "(0, #)" << endl;
break;
}
}
}
}
int main()
{
FILE *fileP;
fileP = fopen("test.txt", "r");
cout << "------词法分析如下------" << endl;
analyse(fileP);
return 0;
}
有大佬知道该怎么办吗?程序可以调试没有错误,但是一运行就出错。
0x79BEE906 (ucrtbased.dll) (ConsoleApplication1.exe 中)处有未经处理的异常: 将一个无效参数传递给了将无效参数视为严重错误的函数。相关推荐
- 0x0FF0ED76 (ucrtbased.dll) (Project5.exe 中)处有未经处理的异常: 将一个无效参数传递给了将无效参数视为严重错误的函数。 出现了
void drop(int a)//一个删除deque容器中元素的函数{deque<int>::iterator it;it = kn.begin();kn.erase(it+a);cou ...
- VScommunity2019 0x00007FFCCA14B7EC (ucrtbased.dll) (Project1.exe 中)处有未经处理的异常: 将一个无效参数传递给了将无效参数视为严重错误
0x00007FFCCA14B7EC (ucrtbased.dll) (Project1.exe 中)处有未经处理的异常: 将一个无效参数传递给了将无效参数视为严重错误的函数. 读某一个文件,但是并没 ...
- 0x00007FFE81272FE1 (ucrtbased.dll) (Project1.exe 中)处有未经处理的异常: 0xC0000005: 读取位置 0x0000000000000000 时发
0x00007FFE81272FE1 (ucrtbased.dll) (Project1.exe 中)处有未经处理的异常: 0xC0000005: 读取位置 0x0000000000000000 时发 ...
- 0x00007FFE9071C408 (ucrtbase.dll) (xxx.exe 中)处有未经处理的异常: 将一个无效参数传递给了将无效参数视为严重错误的函数。
1.调试VS程序,弹出异常:0x00007FFE9071C408 (ucrtbase.dll) (xxx.exe 中)处有未经处理的异常: 将一个无效参数传递给了将无效参数视为严重错误的函数. 2.在 ...
- 0x79B2A261 (ucrtbased.dll) (Project4.exe 中)处有未经处理的异常: 0xC0000005: 写入位置 0x00A41023 时发生访问冲突。
scanf_s("%c %c",&c1,&c2); 在v2019上输入以上代码可能会出现由于0xC0000005: 写入位置 0x00A41023 时发生访问冲突等 ...
- 0x0F1AFD76 (libcocos2d.dll) (Plane.exe 中)处有未经处理的异常: 0xC0000005: 读取位置 0x00000018 时发生访问冲突。
0x0F1AFD76 (libcocos2d.dll) (Plane.exe 中)处有未经处理的异常: 0xC0000005: 读取位置 0x00000018 时发生访问冲突. Get data fr ...
- (转载)0x0F1AFD76 (libcocos2d.dll) (Plane.exe 中)处有未经处理的异常: 0xC0000005: 读取位置 0x00000018 时发生访问冲突。
原文地址:http://blog.csdn.net/u010398774/article/details/23567441 0x0F1AFD76 (libcocos2d.dll) (Plane.exe ...
- 已解决 0x0000XXXX (ucrtbase.dll) (XXX.exe 中)处有未经处理的异常: 请求了严重的程序退出。
已解决!ucrtbase.dll, XXX.exe 中处有未经处理的异常: 请求了严重的程序退出. 问题描述 解决方法 问题描述 最近在编译IFC++工程,发现在运行的时候VS2019弹出了相关错误提 ...
- 0x00007FF9BF948828 (Qt5Core.dll) (QtGuiApplication3.exe 中)处有未经处理的异常: 请求了严重的程序退出——解决方案
这篇文章详细介绍了在使用vs+Qt+Vtk环境下Debug模式会报错,但是在Release模式下没有发生问题.环境的配置主要是参考以下文章详细的VTK VS QT配置 vtk8.2.0 + vs201 ...
最新文章
- 《数据虚拟化:商务智能系统的数据架构与管理》一 1.11 数据集成的其他方式...
- Nat. Mach. Intel. | IBM RXN: 深度学习在化学反应分类上大放异彩
- spring (由Rod Johnson创建的一个开源框架)
- python下三角代码分析_空间分析:2-3。用Python生成Delaunay三角形,23Python,德劳内
- ASP.NETSpring.NETNHibernate最佳实践(三)——第2章环境准备
- md5课程设计java_MD5算法的JAVA实现
- [css] 使用css实现悬浮提示文本
- python如何输出两列数据_Python-如何将一列分为两列?
- QT读取csv文件并且绘制折线图
- IDEA配置SpringBoot的springloaded热部署(写方法、属性不用重启)
- 逻辑学 —— 复杂问题谬误
- 微软 Windows 10 将支持 8 英寸以下 ARM 平板设备
- 【系统分析师之路】2020年下系统分析师论文写作真题
- 《富爸爸,穷爸爸》这本书有何价值?
- 服务器SAS硬盘raid5崩溃lvm丢失的数据恢复过程
- Android获取手机序列号
- vue3 打印插件 vue-print-nb
- Ubuntu 远程控制(使用自带远程工具)
- [产品规划]行业公司如何做产品
- BZOJ 3698: XWW的难题(有源汇上下界最大流)