I am trying to write a code to read data from file. The file looks like:
47012 "3101 E 7TH STREET, Parkersburg, WV 26101"
48964 "S16 W22650 W. LINCOLN AVE, Waukesha, WI 53186"
.
.
.
.
I need to store the number as an int and the address as a string.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream myfile;
myfile.open("input.txt");
long int id;
string address;
myfile >> id;
cout << id << endl;
myfile >> address;
cout << address.c_str() << endl;
myfile.close();
system("pause");
return 0;
}
The output of program
47012
"3101
The output that I need is
47012
3101 R 7TH STREET, Parkersburg, WV 26101
How do I go about doing this. Thanks in advance Any help is appreciated