i need c++ code for simple linked list to implement algorith and data structure

1.create_node_and add to list
2.frst node delete 
3.last node delete 
4.delete node between first and last node 
5. displaye the value of node in revese order
6. searching 
7.exist 

Yeah... this site doesn't really work like that. Did you read the notes before posting?

Write some code and someone will help you fix/understand the errors. Generally, no-one's going to just striaght-up do your homework for you. You have to show some effort first.

#include <iostream>

using namespace std;
struct student
{
    string fname;
    int age;
    student*next;
}
void creat_node_and_add_to_list();
void first_node_delete();
void last_node_delete();
void delete_node_between_first_and_last_node();
void display_the-value_of_node_in_reverse_order();
void search();
student *first=NULL,current,previous;
student*key;

int main()
{
    int choice;
    cout<<"what do you want to do \n";
    cout<<"1.create_node_and add to list \n";
    cout<<"2.frst node delete \n";
    cout<<"3.last node delete \n";
    cout<<"4.delete node between first and last node \n ";
    cout<<"5. displaye the value of node in revese order \n";
    cou<<"6. searching \n";
    cout<<"7.exist \n";
    cin>>choice;
    if(choise==1)
    create_node_and_add_to_list();
    else if(choise==2)
    first_node_delete();
    else if(choise==3)
    last_node_delete();
    else if(choise==4)
    delete_node_between_first_and_last_node();
    else if(choise==5);
    display_the_value_of_node_in_reverse_order();
    else if(choise==6);
    search();
    else(choise>7||chopise<1)
    cout<<"enter the the correct value bteween 7 and 1 \n";
    while(choise!=7)
}

    void create_node_and_add-to_list();
    char ans;
    do
    {
        student*stud=new student;
        cout<<"enter the first name of the student \n";
        cin>>stud->fname;
        cout<<"enter the age of the student \n";
        cin>>stud->age;
        stud->next=NULL;
        if(first==NULL);
        first=stud;
        else 
        current=first;
        while(current->!=NULL)
        current=current->next;
        current->next=stud;
    }

    cout<<"do you want to add another node (y/n) \n";
    cin>>ans:
    while(ans=='y'||ans'Y')

    void delete_the_first_node()
    {
        student*current;
        current=first;
        first=first->next;
        delete current;
    }    


    void last_node_delete();
    node*current,*previous;

    if(first==NULL)
    cout<<"the listb is empty \n";
    else
    current=first;
    if(current==NULL)
    {
        delete current;
        first=NULL;


    }
    else
    {
        while(current->next!=NULL)
        {
            previous=current;
            current=current->next;
        }
        delete current;
        previous->next=NULL;
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.