Mar 4, 2015 at 2:32pm UTC
Every time i compile it gives me the error:
invalid conversion from ‘int’ to ‘const char*’
I know that this has to do with atoi and that is what i want to use to solve this problem. What am i forgetting or doing wrong? Please do not give me an answer with a vector as it will not help me with my problem at all.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <string>
#include "TrainData.h"
using namespace std;
void TrainingSet::SetEntry()
{
string variable;
int var;
while (gameData)
{
getline(gameData, variable, ' ' );
trainingEntries[numberOfEntries].setDown(variable);
trainingEntries[numberOfEntries].NormalizeDown();
getline(gameData, variable, ' ' );
var = atoi(variable.c_str());
trainingEntries[numberOfEntries].SetYTG(var);
trainingEntries[numberOfEntries].NormalizeYTG();
getline(gameData, variable);
trainingEntries[numberOfEntries].SetTarget(variable);
trainingEntries[numberOfEntries].NormalizeTarget();
numberOfEntries++;
}
}
Last edited on Mar 4, 2015 at 3:09pm UTC
Mar 4, 2015 at 2:43pm UTC
What line is giving you the error?
Mar 4, 2015 at 2:46pm UTC
23
here is that function
1 2 3 4
void TrainingEntry::SetYTG(int input)
{
YTG = input;
}
Last edited on Mar 4, 2015 at 2:50pm UTC
Mar 4, 2015 at 3:20pm UTC
If you want to delete this topic you can I found out what the problem was and it had nothing to do with what i was doing.