hey, this is my problem/homework. A user inputs a city and state and the program searches a text file for the name. The latitude and longitude is given in the text file and the distance is calculated.
The stuff in the txt file are in this format: " [Los_Angeles/CA:city] 34.08616 -118.37598 "
I have to make 3 arrays (for city, latitude, and longitude). My problem is that I can't get the array to read the city. Here is my code:
Code:#include<iostream> #include<fstream> #include<iomanip> #include<cstdlib> //includes libraries #include<string> using namespace std; const int SIZE= 25374; string name[SIZE]; double latitude[SIZE]; double longitude[SIZE]; int main() { ifstream inStream; inStream.open("US-PLACES.txt"); for(int i=0;i<=25374;i++){ inStream>>name[i]; cout<<i<<endl; } cout<<"hey"; for(int j=0;j<25374;j++){ cout<<name[i]; } cout<<"hey"; return(0); }



LinkBack URL
About LinkBacks


