All pastes #209003 Raw Edit

Mine

public cpp v1 · immutable
#209003 ·published 2006-10-18 23:24 UTC
rendered paste body
#include <iostream>#include <string>#include <sstream>#include <fstream>#include <vector>#include <map>using namespace std;class Node {	char _name;	map<char, Node> links;  public:	Node();	Node(char name);	void linkNode(Node* linkedNode);};Node::Node(char name) {	_name = name;}void Node::linkNode(Node* linkedNode) {	//_linkedNodes.push_back(linkedNode);}void addNodes(vector<Node*>* nodes, char edge, Node * node1, Node * node2) {	//nodes->push_back(node1);	//nodes->push_back(node2);}int main() {	ostringstream output;	vector<Node*> nodes;	while (true) {		cout << "graphprog> ";		string cmd;		char n1, n2, edge;		cin >> cmd;		if (cmd == "add") {			cin >> edge >> n1 >> n2;				output << edge << " " << n1 << " " << n2 << endl;			addNodes(nodes, edge, new Node(n1), new Node(n2)); 		}		else if (cmd == "write") {			string outfileName;			cin >> outfileName;			ofstream outfile(outfileName.c_str());			outfile << output.str();		}		else if (cmd == "show") {			cout << output.str();		}		else if (cmd == "quit") {			break;		}	}	return 0;}