Question
please help due tonight pls help faulting out line 102 c++ language here is error: #include #include #include #include #include Graph.h #include RomanVertex.h #include RomanEdge.h
please help due tonight pls help faulting out line 102
c++ language here is error:
#include
using namespace std;
//Function prototypes Graph
int main(int argc, const char *argv[]) { //First off, check for valid command-line input if (argc
cerr
}
//Say the names of the files we got cout
//Next, readthe verticies and edges of the graph Graph
//Print all verticies as they are cout printVerticies();
//Do the BFS cout bfsList = graph->bfs();
//Print its list while (!bfsList.empty()) {
cout key
}
//Do the DFS cout dfsList = graph->dfs();
//Print its list while (!dfsList.empty()){
cout key
}
//Done! Delete the graph, return 0 delete graph; return 0;
}
Graph
//Make and open file ifstream inFile(fileName);
//Check for read error if (!inFile){
cerr
}
//Buffer for the current line we're reading string currentLine;
//Get the first line getline(inFile, currentLine);
//Make a list of all the vertex names, and keep its length list
//Read vertex names as long as the file isn't over while (!inFile.eof()){
//Check for a at the end of the string if (currentLine.back() == ' '){
//Get rid of it currentLine.erase(currentLine.length() - 1);
}
listLength++; vertexList.push_back(currentLine); getline(inFile, currentLine);
}
//close file inFile.close();
//Make the graph Graph
//Make a vertex for each item, and add it to the graph for (int i = 0; i
//Make a new vertex RomanVertex *currentVertex = new RomanVertex;
//add info to the fields currentVertex->key = vertexList.front(); currentVertex->numEdges = 0; currentVertex->isMarked = false;
//pop the first element vertexList.pop_front();
//add the vertex to the graph graph->addVertex(currentVertex);
}
//Return the graph return graph;
}
void readEdges(const char *fileName, Graph
//Make and open file ifstream inFile(fileName);
//Check for read error if (!inFile){
cerr
}
//Current line we're reading. It will be split into three parts. string currentStart, currentEnd, currentWeight;
//Get the first line, in its three parts getline(inFile, currentStart, ' '); getline(inFile, currentEnd, ' '); getline(inFile, currentWeight, ' ');
//Read data while the file has more lines while (!inFile.eof()){
//Convert the string to a double double weight = atof(currentWeight.c_str());
//Check the weight if (weight
cerr
//get the next line getline(inFile, currentStart, ' '); getline(inFile, currentEnd, ' '); getline(inFile, currentWeight, ' ');
continue; //ignore the edge
}
//Check the verticies if (currentStart == currentEnd){
cerr
continue;
}
//Add the edge to the graph graph->addEdge(currentStart, currentEnd, weight);
//get the next line getline(inFile, currentStart, ' '); getline(inFile, currentEnd, ' '); getline(inFile, currentWeight, ' ');
}
//Close the file. inFile.close();
}
C: \Users\Adam Horton\Desktop CSC 2400 ProgramOne>g++ c main.cpp main.cpp: In function 'GraphStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started