Question

C++ Program Error (Graph Problem):

I am getting an error claiming that a vector I need to use for my program is out of scope.

Here is the error message:

Graph.cpp: In function ‘void assignDistricts(): Graph.cpp:99:22: error. ‘vertices, was not declared in this scope for(int í = 0 ; í < vertices . size() ; i++) s.size) i++) Graph.cpp:99:22: note: suggested alternative : ‘vertex, fo r (int í = 0 ; í vertices.size() ; í++) AnnN vertex Graph.cpp:101:6: error: ‘verticies, was not declared in this scope if(verticies[i].district<0) Graph.cpp:101:6: alternative : ‘vertex, suggested 0) note: if(verticies[i].district ANNnNNNNn vertex

The verticies vector is declaired as a private method (I assume the error has something to do with this).

Here is my code for the assignDistricts() method and verticies vector:

Does anyone know what the problem is?

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
C++ Program Error (Graph Problem): I am getting an error claiming that a vector I need...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Can someone please help me. i keep getting an error in my code. I need it...

    Can someone please help me. i keep getting an error in my code. I need it to be on three seperate files! attached is my assignment and my code. c++ The class date Type implements the date in a program. Write the class functions as specified in the UML class diagram. The values for the month, day, and year should be validated (in the class functions) before storing the date into the data members. Set the invalid member data to...

  • Am I getting this error because i declared 'n' as an int, and then asking it...

    Am I getting this error because i declared 'n' as an int, and then asking it to make it a double? This is the coude: #include "stdafx.h" #include <iostream> #include <fstream> #include <string> #include <algorithm> #include <vector> using namespace std; void sort(double grades[], int size); char calGrade(double); int main() {    int n;    double avg, sum = 0;;    string in_file, out_file;    cout << "Please enter the name of the input file: ";    cin >> in_file;   ...

  • Help !! I need help with Depth-First Search using an undirected graph. Write a program, IN JAVA, ...

    Help !! I need help with Depth-First Search using an undirected graph. Write a program, IN JAVA, to implement the depth-first search algorithm using the pseudocode given. Write a driver program, which reads input file mediumG.txt as an undirected graph and runs the depth-first search algorithm to find paths to all the other vertices considering 0 as the source. This driver program should display the paths in the following manner: 0 to ‘v’: list of all the vertices traversed to...

  • Need Help ASAP!! Below is my code and i am getting error in (public interface stack)...

    Need Help ASAP!! Below is my code and i am getting error in (public interface stack) and in StackImplementation class. Please help me fix it. Please provide a solution so i can fix the error. thank you.... package mazeGame; import java.io.*; import java.util.*; public class mazeGame {    static String[][]maze;    public static void main(String[] args)    {    maze=new String[30][30];    maze=fillArray("mazefile.txt");    }    public static String[][]fillArray(String file)    {    maze = new String[30][30];       try{...

  • C++ Code error help. I am getting the error: "expression must have a constant value, the...

    C++ Code error help. I am getting the error: "expression must have a constant value, the value of parameter 'n' ( declared at line 7) cannot be used as a constant" I am also getting this error at lines 65 and 66 with m and n. I do not know how to fix this. Here is my code and ive marked where the errors were with lines: #include<iostream> using namespace std; // Function to allocate memory to blocks as per...

  • I am currently doing homework for my java class and i am getting an error in...

    I am currently doing homework for my java class and i am getting an error in my code. import java.util.Scanner; import java.util.Random; public class contact {       public static void main(String[] args) {        Random Rand = new Random();        Scanner sc = new Scanner(System.in);        System.out.println("welcome to the contact application");        System.out.println();               int die1;        int die2;        int Total;               String choice = "y";...

  • In c++ please How do I get my printVector function to actually print the vector out?...

    In c++ please How do I get my printVector function to actually print the vector out? I was able to fill the vector with the text file of names, but I can't get it to print it out. Please help #include <iostream> #include <string> #include <fstream> #include <algorithm> #include <vector> using namespace std; void openifile(string filename, ifstream &ifile){    ifile.open(filename.c_str(), ios::in);    if (!ifile){ cerr<<"Error opening input file " << filename << "... Exiting Program."<<endl; exit(1); }    } void...

  • C#, I am getting error placing them all in one file pls set them in the...

    C#, I am getting error placing them all in one file pls set them in the order that all 3 work in one file. Thanks //Program 1 using System; class MatrixLibrary { public static int[,] Matrix_Multi(int[,] a, int [,]b){ int r1= a.GetLength(0); int c1 = a.GetLength(1); int c2 = b.GetLength(1); int r2 = b.GetLength(0); if(r2 != c2){ Console.WriteLine("Matrices cannot be multiplied together.\n"); return null;    }else { int[,] c = new int[r1, c2]; for (int i = 0; i <...

  • The following is a program from Starting out with C++ by Toni Gaddis. I am getting the following error messages pertain...

    The following is a program from Starting out with C++ by Toni Gaddis. I am getting the following error messages pertaining to the lines: cin>>month[i].lowTemp; and months[i].avgTemp = (months[i].highTemp + month[i].lowTemp)/2; The error messages read as follows: error C2039: 'lowTemp': is not a member of 'std::basic_string<_Elem,_Traits,_Ax>' and it continues. The second error message is identical. The program is as follows: Ch. 11, Assignment #3. pg. 646. Program #4. //Weather Statistics. //Write a program that uses a structure to store the...

  • C++ getline errors I am getting getline is undefined error messages. I would like the variables...

    C++ getline errors I am getting getline is undefined error messages. I would like the variables to remain as strings. Below is my code. #include <iostream> #include<string.h> using namespace std; int index = 0; // variable to hold how many customers are entered struct Address //Structure for the address. { int street; int city; int state; int zipcode; }; // Customer structure struct Customer { string firstNm, lastNm; Address busAddr, homeAddr; }; // Functions int displayMenu(); Customer getCustomer(); void showCustomer(Customer);...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT