Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 11-04-2004, 09:43 AM   #1 (permalink)
toast28
Registered User
 
Join Date: Sep 2004
Posts: 21
toast28 is on a distinguished road
Little help

Ok, I'm writing a program that reads in the representaion of a weighted graph and finds the center, diameter, and center of each component. But thats not my problem yet, I started writing the basic skeleton of my program and can't get it to compile. Its giving me an error about missing a ; before using in the using namespace std line. I just want someone to look it over and find the hopefully simple error I made.

Code:
// file used to input a graph for any number of files
#include "stdinc.h"
//#include "map.h"
#include "network.h"

using namespace std;

int main(int argv, char *argc[])
{	
	//declare variables
	int numofcomponents=0;
	network sam;
	
	for(int j=0;j<argv;j++)
	{
		// read in files, possibly more than one

		// display map

		//find connected components(floyd-warshall)

	
	
		for(int i=0;i<numofcomponents;i++) // look for each component
		{
			// display component
	
			// find diameter and shortest path that touches diameter

			// find center of component

			// travelling salesman problem(extra credit)
		}

	}
	return 0;
}
toast28 is offline   Reply With Quote
Old 11-04-2004, 10:08 AM   #2 (permalink)
toast28
Registered User
 
Join Date: Sep 2004
Posts: 21
toast28 is on a distinguished road
As I look at this more, I'm pretty sure my problem is in network.h or network.cpp. Here is my code for those


Code:
// network.h
// declaration file for network class


#include "stdinc.h"
//#include "network.cpp"


using namespace std;

const int MAX_NODES=100;

class network
{
	public:
		network(); // default constructor
		void insertedge(int first, int second); // insert function to add an edge between 2 nodes
		void deleteedge(int first, int second); // delete edge from 2 nodes, may not need this
		void clearnetwork(); // set adj matrix, N, and M to all 0's
		void read_network(char* file_name);// read a network in from a file
		void print_network();  // prints the graph
		void numbers(int& n, int& m); //return the numbre of edges

	protected:
		int N; // num of nodes in graph
		int M; // num of edges in graph
		int adj[MAX_NODES][MAX_NODES]; // adjacency matrix 

}
Code:
#include"network.h"
#include"stdinc.h"

using namespace std;

network::network()// default constructor
{
	N=0;
	M=0;
}


void network::insertedge(int first, int second) // insert function to add an edge between 2 nodes
{

}

void network::deleteedge(int first, int second) // delete edge from 2 nodes, may not need this
{

}

void network::clearnetwork() // set adj matrix, N, and M to all 0's
{
	for(int i=0;i<MAX_NODES;i++)
	{
		for(int j=0;j<MAX_NODES;j++)
		{
			adj[i][j]=0;
		}
	}
	N=0;
	M=0;

}

void network::read_network(char* file_name)// read a network in from a file
{

}

void network::print_network()  // prints the graph
{

}

void network::numbers(int& n, int& m) //return the numbre of edges
{

}
toast28 is offline   Reply With Quote
Old 11-04-2004, 10:18 AM   #3 (permalink)
toast28
Registered User
 
Join Date: Sep 2004
Posts: 21
toast28 is on a distinguished road
nevermind, after putting a ; after the network class it compiles just fine
toast28 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 03:21 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting