I have also attached the file that should be read.
Any help would be greatly appreciated.
Thanks.
#include <iostream>
#include <fstream>
#include "genlib.h"
#include "simpio.h"
#include "cmpfn.h"
#include "vector.h"
#include "PQueue.h"
#include "DataStruct.h"
ifstream infile;
int main() {
cout << "Name of File: ";
string file= GetLine();
infile.open(file.c_str());
datastruct dstruct;
string city= "";
double x, y= 0;
while (true) {
infile >> city >> x >> y;
dstruct.addNode(city, x, y);
if (city=="ARCS") {
break;
}
}
while (!infile.fail()) {
string from= "";
string to= "";
int distance= 0;
infile >> from >> to >> distance;
dstruct.addArc(from, to, distance);
}
dstruct.get("WashingtonDC");
return 0;
}
Attached File(s)
-
Small.txt (255bytes)
Number of downloads: 33

New Topic/Question
Reply



MultiQuote




|