fix: use vector <int> to fix the variable int arr
This commit is contained in:
parent
a68b31a3ce
commit
84575da5b8
1 changed files with 4 additions and 2 deletions
|
@ -81,7 +81,8 @@ void readInputFile(const string &filename,
|
||||||
string line;
|
string line;
|
||||||
while (getline(infile, line)) {
|
while (getline(infile, line)) {
|
||||||
istringstream iss(line);
|
istringstream iss(line);
|
||||||
string fields[intmax + 1];
|
vector<string> fields(intmax + 1);
|
||||||
|
// string fields[intmax + 1];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (iss >> fields[i] && i < (intmax + 1)) {
|
while (iss >> fields[i] && i < (intmax + 1)) {
|
||||||
i++;
|
i++;
|
||||||
|
@ -110,7 +111,8 @@ void processMap(const map<string, pair<double, string>> &max_map,
|
||||||
const int intmax) {
|
const int intmax) {
|
||||||
for (const auto &entry : max_map) {
|
for (const auto &entry : max_map) {
|
||||||
istringstream iss(entry.second.second);
|
istringstream iss(entry.second.second);
|
||||||
string fields[intmax + 1];
|
vector<string> fields(intmax + 1);
|
||||||
|
// string fields[intmax + 1];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (iss >> fields[i] && i < (intmax + 1)) {
|
while (iss >> fields[i] && i < (intmax + 1)) {
|
||||||
i++;
|
i++;
|
||||||
|
|
Loading…
Reference in a new issue