I need help

I'm trying to add a search and delete function to my program

#include <Windows.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <iostream>

using namespace std;

class Cvampire{
int info;
int iStrength;
string sName;
Cvampire *next;
Cvampire *prev;
Cvampire *name;


Cvampire *Head = new Cvampire;

void Add(string Name, int Strength){
Cvampire *Add;
Cvampire *Run;

//Find the end of the list.
for(Run=Head; Run->next!=Head;Run=Run->next);
//semicolon as the loop is doing nothing else.
//Grab Memory from the operating system for new Cvampire/
Add = new Cvampire;
//Add the properties (Name and Strength).
Add->iStrength = Strength;
Add->sName = Name;
//Point the new item back to the header.
Add->next = Head;
Add->prev = Run;

//Add the new Cvampire to the end of the list.
Run->next = Add;
Head->prev = Add;


void find()
Cvampire *Run;

//void remove(){
// Cvampire *Run;
// for(Run=Head->next;Run!=Head;Run = Run->next)
// {
// delete Run;
// cout << Run->sName <<" "<< Run->iStrength << endl;
// }

//void sort(){
// Cvampire *Run;
// int name;
// for(Run->next!=Head && Run->next->name<<name){
// }

void Print(){
Cvampire *Run;

for(Run=Head->next;Run!=Head; Run = Run->next)
cout << Run->sName <<" "<< Run->iStrength << endl;
for(Run=Head->prev;Run!=Head; Run = Run->prev)
cout << Run->sName <<" "<< Run->iStrength << endl;

void main(void){
Head->next = Head; //closing looplink.
Head->prev = Head;

Add("Dog", 30);
Add("Cat", 25);
Add("Ant", 1);
Add("Eel", 20);
Add("Bat", 40);
Add("Fox", 35);


Hey. It looks like you're wanting to use a doubly-linked list of classes. When you reach the node you want to remove, write code to call your function to delete it and then re-link the list from the nodes on either side of the node you're deleting.
Please indent and use [ code][ /code] tags.
where exactly should I write code at?
You can select your code and click on the <> format button on the right. It'll put the tags around the code.
Topic archived. No new replies allowed.