The program below should in theory create a linked list which the user can then add, display or subtract(not relevant). Currently my issue is trying to get more than one value to print on my linked list. 

The main issue I'm pretty sure comes from the function add\_node but I can't seem to get it to change at all. (There is a subtract class option, but I omitted the function because it was not relevant.)

What do I need to change to get this to add to the linked list?

any help would be greatly appreciated

```
#include <iostream>
#include <cstring>

struct ToDoList
{
    std::string start_time;
    std::string activity_name;
    int time_for_activity;
    ToDoList *next;
};

void add_node(ToDoList * & head, std::string start, std::string activity,int time )
{
    ToDoList* temp;
    head = new ToDoList;
    temp = new ToDoList;
    head-> start_time = start;
    head-> activity_name = activity;
    head-> time_for_activity = time;
    head-> next = head;
    head = temp;
    temp = temp->next;
    head->next=NULL;
}//in theory this should add another node to the list but it isn't working

int main()
{
    int ans, i = 0;
    std::string start;
    std::string activity;
    int time;
    ToDoList* head;
    ToDoList* a;
    std::cout << "Enter the start time in HH:MM am format: ";
    std::getline(std::cin, start);
    std::cout << "Enter the activity name: ";
    std::getline(std::cin, activity);
    std::cout << "Enter the time for the activity: ";
    std::cin >> time;
    //~ add_node(head);
    add_node(head,start,activity,time);

    std::cout << "\nWelcome to the Linked list menu! What would you like to do? \n0 Add a Node \n1 Display the list \n2 Delete a node \n3 Quit \n";
    std::cin >> ans;
    while(ans != 3)//This should print all the values in the list
    {
        std::cin.ignore();
        if(ans == 0)
        {   
            std::cout << "Enter the start time in HH:MM am format: ";
            std::getline(std::cin, start);
            std::cout << "Enter the activity name: ";
            std::getline(std::cin, activity);
            std::cout << "Enter the time for the activity: ";
            std::cin >> time;
            add_node(head,start,activity,time);

        }
        else if( ans == 1 )
        { 
            a = new ToDoList;//creates new pointer for while loop
            a = head;
            while(a != NULL )//loop used for printing
            {
                std::cout << i << " " << a->start_time << " " << a->activity_name << " " << a->time_for_activity << "\n";
                a = a -> next;
                i++;
            }
            i = 0;//resets integer i
        }
        std::cout << "\nWelcome to the Linked list menu! What would you like to do? \n0 Add a Node \n1 Display the list \n2 Delete a node \n3 Quit \n";
        std::cin >> ans;
    }
    return 0;
}

```

So far it only prints the following:

```
Enter the start time in HH:MM am format: 10:00 am
Enter the activity name: Office Hours
Enter the time for the activity: 30

Welcome to the Linked list menu! What would you like to do? 
0 Add a Node 
1 Display the list 
2 Delete a node 
3 Quit 
0
Enter the start time in HH:MM am format: 11:00 am 
Enter the activity name: Lunch
Enter the time for the activity: 60

Welcome to the Linked list menu! What would you like to do? 
0 Add a Node 
1 Display the list 
2 Delete a node 
3 Quit 
1
0   0
test

```