I am having with some problems with a project I am working on. I need to output simple statistics of the "ps -ef" using the line "ps -ef | a.out", a.out being my program.

To store the information I need to use a Hashtable of Linked Lists, without using STL. The Hashtable gets the key by attaining the ASCII value of all the elements in the username string, adding them one by one and dividing by the total (120). This key + value points to a linkedlist of the same name with all the info, which also needs to then be able to print out the total time, etc.

My major problem is with importing the info from input straight into the linked list, and then making the key.

My code is below, and doesn't exactly compile. Can anyone please run through it quickly and tell me what I am doing wrong, I can't get it to work.

Thanks in advance,

Note: Sorry, none of the buttons seem to be working for me, or the file uploader!

#include <iostream>

#include <string>

using namespace std;

// Global Constants
const int MAX = 120; // Max users

// Node Data Structure

struct Node{

	string uid;	// Username Identification

	int pid;	// Process User Identification
	int ppid;	// Parent Processer Identification
	int c;		// C

	string sysTime;	// System Time
	string TTY;	// Terminal Process
	int mm, ss;	// Total Running Time: Minutes, Seconds

	string cmd;	// Command Line

	Node *Next;	// Link


// Linked List Data Structure	

class LinkedList{


		Node *Current, *Head, nodeData;	// Node Pointers
		int totalMins, totalSecs;
		string lngCmd;


		LinkedList();		   // Constructor

		void Add();		   // Adds To The Linked List
		void printUserName();	   // Prints user name
		void printPid();	   // Prints Parent Identification
		int getTotalMinutes();	   // Returns total amount of minutes for a user
		int getTotalSeconds();     // Returns total amount of seconds for a user
		void checkLongestCmd();	   // Checks if a string is longer than previous
		string returnLongestCmd(); // Returns longest command

		bool isEmpty();		   // Checks if list is empty

		~LinkedList();		   // Destructor




	Head = NULL;



void LinkedList::Add(){

	Node *Temp;

	Temp = new Node;

	Temp->uid = nodeData.uid;

	Temp->pid = nodeData.pid;
	Temp->ppid = nodeData.ppid;
	Temp->c = nodeData.c;
	Temp->sysTime = nodeData.sysTime;
	Temp->TTY = nodeData.TTY;

	Temp->mm = nodeData.mm;
	totalMins += nodeData.mm;	// adds up minutes

	Temp->ss = nodeData.ss;
	totalSecs += nodeData.ss;	// adds up seconds
	Temp->cmd = nodeData.cmd;

	Temp->Next = NULL;

	Current = Head;

	while (Current->Next != NULL)

		Current = Current->Next;

	Current->Next = Temp;


void LinkedList::printUserName(){
	Node *Temp;
	Temp = new Node;
	cout << Temp->uid;

void LinkedList::printPid(){
	Node *Temp;
	Temp = new Node;
	cout << Temp->pid;

int LinkedList::getTotalMinutes(){
	return totalMins;

int LinkedList::getTotalSeconds(){
	return totalSecs;

void LinkedList::checkLongestCmd(){
	Node *Temp;
	Temp = new Node;
	Current = Head;
	while (Current != NULL){
		if (Current->cmd.length() > Temp.Next->cmd.length())
			lngCmd = Current->cmd;
			lngCmd = Next->cmd;
	Current = Temp->Next;

string LinkedList::returnLongestCmd(){
	return lngCmd;

bool LinkedList::isEmpty(){

	if (Head == NULL)

		return true;


		return false;



	Node *Temp;


	while(Head != NULL){

		Temp = Head;

		Head = Head->Next;

		delete Temp;



// Hash Table Data Structure	

class HashTable{


	// Variables

	Node *p;

	int asciiVal;
	LinkedList Table[MAX];

	// Functions


	int generateKey(string userName);	// Generate Key




	// Initiate Data


int HashTable::generateKey(string userName){

	userName = p->uid;

	for (int a = 0; a != userName.length(); ++a)

		asciiVal += int (userName[a]);

	asciiVal = asciiVal % MAX;

	return asciiVal;



	// Delete Pointers



int main(){

	Node *node;

	node = new Node;

	while (!cin.fail()){

		cin >> node->uid;

		cin >> node->pid;
		cin >> node->ppid;
		cin >> node->c;
		cin >> node->sysTime;
		cin >> node->TTY;

		cin >> node->mm;

		cin >> node->ss;

		cin >> node->cmd;



	for (int i = 0; i < MAX; i++;){
		cout << "User " << Table


	system ("PAUSE");

	return 0;


Update: I managed to find a PC and upload the file. Its updated and now my problems lie within the add node I believe. If anyone can help, it would be greatly appreciated.