在调试的时候闪退
调试控制台显示
ERROR: GDB exited unexpectedly with exit code -1073741819 (0xC0000005). Debugging will now abort.
Stopping due to fatal error: AD7Exception: Unable to evaluate expression. The debug engine threw an exception.
两条错误信息
#include <iostream>
#include <string>
using namespace std;
int main()
{
string idol[10000],mediation;
int rows = 0;
while (getline(cin,mediation))//分行读入范文
{
if (mediation == "EOF")//当单独一行EOF时结束
{
break;
}
idol[rows] = idol[rows] + mediation;//分行写入范文
rows++;//换行
}
int count = 0;//计数
rows = 0;//重新从0行开始
while (getline(cin,mediation))
{
if (mediation == "EOF")
{
break;
}
for (int i = 0 , j = 0; i < (idol[rows].length()) && j < (mediation.length()); i++,j++)
{
if (idol[rows][i] == mediation[j] )//对比输入行与范文行的每个字
{
count++;
}
else
{
if (mediation[j + 1] == '<' && j)//下一位是< 且j不是0不是第一位
{
j++;
i--;
}
}
}
rows++;//换行
}
int times;
cin >> times;
count = count / (times / 60.0) + 0.5;//计算kpm
cout << count << endl;
return 0;
}
输入样例
hello world.
aaabbbb
x
EOF
heelo world.
aaacbbbb
y<x
EOF
60
输出
18