用到了类string的length(), size(),find_first_of(),find_last_of(),substr(),push_back()函数
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
struct errorLog
{
string name;
string line;
int count;
};
errorLog createErrorLog(string name, string line)
{
errorLog log;
int nameSize = name.length();
int index = -1;
index = name.find_last_of('\\');
name = name.substr(index + 1);
log.name = name;
log.line = line;
log.count = 1;
return log;
}
void recordErrorLog(int number, errorLog log, vector<errorLog> & resu)
{
bool isRepeat = false;
for (int i = 0; i < resu.size(); i++)
{
if (resu[i].name == log.name && resu[i].line == log.line)
{
resu[i].count++;
isRepeat = true;
break;
}
}
if (isRepeat == false)
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- hids.cn 版权所有 赣ICP备2024042780号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务