All pastes #1376115 Raw Edit

Stuff

public text v1 · immutable
#1376115 ·published 2009-03-29 20:29 UTC
rendered paste body
#include <iostream>
#include <string>

using namespace std;

struct NodeChunk{
	//I THINK THIS DECLARATION IS WRONG!!!!!!!!!!!!!!!!!!!!!!!!!
    string *val;
	///////////////////////////////////////////////////
    NodeChunk *next;
};

struct Stack {
    int chunkSize;
    int topElt;
    NodeChunk *firstChunk;
};

NodeChunk* createNewNodeChunk (int N) {
    NodeChunk* n = new NodeChunk;
    n -> val = new string [5];
    return n;
}
void initStack (int chunkSize, Stack& s) {
    Stack *st = &s;
    st -> chunkSize = chunkSize;
    st -> topElt = 0;
    st -> firstChunk = NULL;

}
bool isEmpty (Stack s) {
     return (s.firstChunk == NULL);
     }
void push (string val, Stack& s) {
    
}

void pop (Stack& s) {}

string top (Stack s) {
    assert(!isEmpty(s));



	//HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    //return (s.firstChunk -> (*val));


	//I need this function to return the value of the val variable in the NodeChunk variable





}
void swap (Stack& s) {}

int size (Stack s) {    
    int len = 0;
    NodeChunk* temp = s.firstChunk;
    while(temp->val){
        len += 1;
        temp = temp -> next;                                  
    }
    return len;        
}

int main (int argc, char* argv[]){
    Stack s1;
    initStack(5,s1);
    //cout << isEmpty(s1) << endl;
    cin.get();       
    return 0;
}