Hi I was wondering if anyone could help
I'm receiving a segmentation fault whenever I go to run
my main.cpp on my program. I've never encountered this before
and was wondering if anyone knew how it can be fixed.

The program consist of equiv.h, equiv.cpp, graph.h, graph.cpp, and main.cpp

here are the files

equiv.h
[code] const int maxVertices = 50;

/***

  • Equiv *
  • Equiv is a structure type that holds a *
  • pointer to an array of integers and an *
  • integer of the size of that array. *
    ***/
    struct Equiv
    {
    int* arrayIntegers;
    int arraySize;
    };

bool together(Equiv& e, int x, int y);
void combine(Equiv& e, int x, int y);
[/code]

equiv.cpp

[code]

include <iostream>
include <fstream>
include "equiv.h"

/**

  • together *
  • together returns true if x and y are in the*
  • same set as object e. *
    **/
    bool together(Equiv& e, int x, int y)
    {
    bool sameX = false;
    bool sameY = false;

    for(int i = 0; i < e.arraySize; i++)
    {
    if(e.arrayIntegers[i] == x)
    sameX = true;
    if(e.arrayIntegers[i] == y)
    sameY = true;
    if(sameX && sameY)
    break;
    }
    return (sameX && sameY);
    }

/**

  • combine *
  • combine puts x and y together by combining *
  • the two into the same set. *
    **/
    void combine(Equiv& e, int x, int y)
    {
    if(together(e, x, y))
    return;

    bool switchX = false;
    bool switchY = false;

    if(e.arraySize > 0)
    {
    for(int i = 0; i ...

Ancient Dragon commented: thanks for using code tags correctly the first time :) +36