Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

#include #include #include #include #include "Graph.h" #include "RomanVertex.h" #include "RomanEdge.h"

using namespace std;

//Function prototypes Graph *readVerticies(const char *fileName); void readEdges(const char *fileName, Graph *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 *graph = readVerticies(argv[1]); readEdges(argv[2], 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 *readVerticies(const char *fileName){

//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 vertexList; int listLength = 0;

//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 *graph = new Graph(listLength);

//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 *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 'Graph* readVerticies (const char*): main.cpp:102:23: error : 'std::-cxx11: :string (aka class std::-cxx11: :basic-stringg++ c main.cpp main.cpp: In function 'Graph* readVerticies (const char*): main.cpp:102:23: error : 'std::-cxx11: :string (aka class std::-cxx11: :basic-string

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

Please answer the question below:

Answered: 1 week ago

Question

4. Explain the strengths and weaknesses of each approach.

Answered: 1 week ago