/* Linked List
   CS004 Final Exam
   Student: 
*/

#include <stdio.h>
#include <stdlib.h>

/* Each node in our linked list holds one integer datum
   and a pointer to the next node in the list */
typedef struct _Node {
  int            data;
  struct  _Node  *next;
} Node;

/* A list is just a pointer to a Node */
typedef Node* List;

/* Allocates memory for a new Node that contains 'value'.
   Then appends that new node to the end of 'list'.
   Finally, returns 'list'. */
List InsertAtEnd(List list, int value)
{ 
  /* Fill this in */
}

/* Prints the list of integer data separated by spaces */
void PrintList(List list)
{
  /* Fill this in */
}

int main() {
  int newnum,choice;
  List myList = NULL;

  /* Continue to display the user a menu of options
     until he/she chooses to exit */
  while (1) {
    printf("----------------------\n");
    printf("(1) Insert new number\n");
    printf("(2) Print list\n");
    printf("(3) Exit\n");
    printf("----------------------\n");
    printf("> ");
    scanf("%d", &choice);
    if(choice==1){       // Insert node
      printf("Enter new number: ");
      scanf("%d", &newnum);
      myList = InsertAtEnd(myList,newnum);
    }
    else if(choice==2){  // Print list
      PrintList(myList);
    }
    else if(choice==3){  // Exit
      break;
    }
    else{  // Invalid input
      printf("Please enter a choice between 1 and 3\n");
    }
  }

  return 0;
}

