I'm trying to take an input which will consist of 3 substrings and parse it:
City name, latitude and longitude.
EX: "Monticello 36.8297222 -84.8491667"
So that I can push_back()
the city, latitude, and longitude into their own vector
objects. But I can't figure out how to do that.
vector<string> city;
vector<float> latitude;
vector<float> longitude;
int main(int argc, char* argv[]){
fstream inData;
inData.open(argv[1]); // open the specified file for reading.
string line;
if (!inData.fail()) // if the file exits and is opened successfully
{
while(getline(inData, line)) // read every line from the file until the end
{
//here is where I want to parse and pushback into it's vector
}
}
inData.close();