Click here to Skip to main content
15,877,103 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CFormView and Child Dialogs (read thisprevious post) Pin
K ARUN KUMAR4-May-10 1:00
K ARUN KUMAR4-May-10 1:00 
AnswerRe: How To Restrict Dialog Box in an SDI to be With in Application Boundaries Pin
David Crow4-May-10 3:00
David Crow4-May-10 3:00 
GeneralRe: How To Restrict Dialog Box in an SDI to be With in Application Boundaries [modified] Pin
K ARUN KUMAR4-May-10 18:21
K ARUN KUMAR4-May-10 18:21 
Questionwin32 debug to win32 release mode in vc6 Pin
Member 36537513-May-10 18:52
Member 36537513-May-10 18:52 
AnswerRe: win32 debug to win32 release mode in vc6 Pin
Software_Developer3-May-10 19:23
Software_Developer3-May-10 19:23 
GeneralRe: win32 debug to win32 release mode in vc6 Pin
Member 36537513-May-10 19:57
Member 36537513-May-10 19:57 
QuestionRe: win32 debug to win32 release mode in vc6 Pin
David Crow4-May-10 3:04
David Crow4-May-10 3:04 
Questionhelp with graph syntax Pin
Member 38225323-May-10 15:35
Member 38225323-May-10 15:35 
Hi I have what I think to be a small problem.
I'm working with templated graph class that uses linkedlist for adjacent vertexes.

I'm just trying to test out the functions, but I keep getting a link unresolved error.
I'm thinking I might be typing it wrong, but who knows.
I'm using microsoft visual studio 2008.
thanks in advance.

here's my int main()
i purposely left out my openfile function
(it works,i've used it many times before) :

int main()
{

graphType<int,11> cGraph1();


ifstream fsFileIn,
		 fsFileIn2,
		 fsFileIn3;//for the files 




openFile(fsFileIn,fsFileIn2,fsFileIn3);

cGraph1().createGraph(fsFileIn);


 
  
return 0;

}




here's most of the graphType.h file
(minus all the other header files graphType.h uses):
#ifndef H_graph
#define H_graph

#include <iostream>
#include <fstream>
#include <iomanip>
#include "linkedList.h"
#include "linkedListForGraph.h"
#include "queueLinked.h"         

using namespace std;

const int infinity = 10000000;   

template<class vType, int size>
class graphType
{
public:
   
    void createGraph();
     
      
	void createGraph(ifstream& infile);
	
	void clearGraph();
    

 
    graphType(); 
      

    ~graphType();
      

protected:
    int maxSize;    //maximum number of vertices
    int gSize;      //current number of vertices
    linkedListGraph<vType> graph[size]; //array of pointers
                //to create the adjacency lists (linked lists)

private:
    void dft(vType v, bool visited[]);
      //Function to perform the depth first traversal of 
      //the graph at a particular node. 
};



template<class vType, int size>
void graphType<vType, size>::createGraph()
{
     ifstream infile;
     char fileName[50];

     vType vertex;
     vType adjacentVertex;

     if(gSize != 0)  //if the graph is not empty, make it empty
        clearGraph();

     cout<<"Enter the input file name: ";
     cin>>fileName;
     cout<<endl;

     infile.open(fileName);

     if(!infile)
     {
        cerr<<"Cannot open the input file."<<endl;
        return;
     }

     infile>>gSize;  //get the number of vertices

     for(int index = 0; index < gSize; index++)
     {
         infile>>vertex;
         infile>>adjacentVertex;

         while(adjacentVertex != -999)
         {
             graph[vertex].insertLast(adjacentVertex);
             infile>>adjacentVertex;
         }//end while
     }//end for

     infile.close();
}//end createGraph




template<class vType, int size>
void graphType<vType, size>::createGraph(ifstream& infile)
{
    
     char fileName[50];

     vType vertex;
     vType adjacentVertex;

     if(gSize != 0)  //if the graph is not empty, make it empty
        clearGraph();

     cout<<"Enter the input file name: ";
     cin>>fileName;
     cout<<endl;

     infile.open(fileName);

     if(!infile)
     {
        cerr<<"Cannot open the input file."<<endl;
        return;
     }

     infile>>gSize;  //get the number of vertices

     for(int index = 0; index < gSize; index++)
     {
         infile>>vertex;
         infile>>adjacentVertex;

         while(adjacentVertex != -999)
         {
             graph[vertex].insertLast(adjacentVertex);
             infile>>adjacentVertex;
         }//end while
     }//end for

     infile.close();
}//end createGraph





template<class vType, int size>
void graphType<vType, size>::clearGraph()
{
     int index;

     for(index = 0; index < gSize; index++)
         graph[index].destroyList();

     gSize = 0;
}




     //default constructor
template<class vType, int size>
graphType<vType, size>::graphType()  
{
     maxSize = size;
     gSize = 0;
}

     //destructor
template<class vType, int size>
graphType<vType, size>::~graphType()   
{
     clearGraph();
}







#endif

AnswerRe: help with graph syntax Pin
enhzflep3-May-10 16:19
enhzflep3-May-10 16:19 
GeneralRe: help with graph syntax Pin
Member 38225323-May-10 16:39
Member 38225323-May-10 16:39 
GeneralRe: help with graph syntax Pin
enhzflep3-May-10 17:01
enhzflep3-May-10 17:01 
GeneralRe: help with graph syntax Pin
Member 38225323-May-10 17:10
Member 38225323-May-10 17:10 
GeneralRe: help with graph syntax Pin
enhzflep3-May-10 17:28
enhzflep3-May-10 17:28 
GeneralRe: help with graph syntax Pin
Member 38225323-May-10 17:30
Member 38225323-May-10 17:30 
GeneralRe: help with graph syntax Pin
Cedric Moonen3-May-10 20:30
Cedric Moonen3-May-10 20:30 
Questionatof conversion issue Pin
kasi143-May-10 12:14
kasi143-May-10 12:14 
AnswerRe: atof conversion issue Pin
Tim Craig3-May-10 12:26
Tim Craig3-May-10 12:26 
AnswerRe: atof conversion issue Pin
Stephen Hewitt3-May-10 14:00
Stephen Hewitt3-May-10 14:00 
Questionmaking ini file in Documents and Settings WritePrivateProfileString to Pin
malaugh3-May-10 12:01
malaugh3-May-10 12:01 
AnswerRe: making ini file in Documents and Settings WritePrivateProfileString to Pin
PJ Arends3-May-10 13:18
professionalPJ Arends3-May-10 13:18 
AnswerRe: making ini file in Documents and Settings WritePrivateProfileString to Pin
«_Superman_»3-May-10 13:18
professional«_Superman_»3-May-10 13:18 
AnswerRe: making ini file in Documents and Settings WritePrivateProfileString to [modified] Pin
wangningyu4-May-10 0:06
wangningyu4-May-10 0:06 
QuestionRe: making ini file in Documents and Settings WritePrivateProfileString to Pin
David Crow4-May-10 3:08
David Crow4-May-10 3:08 
Questionbreak point not hit in release mode Pin
rayjoslyn3-May-10 10:57
rayjoslyn3-May-10 10:57 
AnswerRe: break point not hit in release mode Pin
«_Superman_»3-May-10 11:16
professional«_Superman_»3-May-10 11:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.