double circular linked list

must be c++ not anything else

My code goes as far as loading up a list from a file.

I am supposed to be able to do the following but i Am stuck can any one help

Develop code that will store information that will include:

Room number,

First Name of customer,

Surname ofcustomer,

Price for room,

Price for breakfast

Number of nights.

Write a program that reads a list of customers of the hotel into a double circular linked list. These

input data have to be ordered in the increasing order by room number. After your

program reads the last employee, it should allow the list to be updated with additions

and deletions needed for this year progress. The program should make the following


Add These Customers

308 John Smith 55.50 8.50 2

395 Julia Roberts 763 19.5 12

120 John Morgan 45.50 7.50 5

Delete These Customers

315 Mickey Mouse 93 19 3

205 Andie MacDowell 65 2.5 3

After the program updates the list,

q Print the new list of products in increase order by room number.

In order to complete this, do the following sub-tasks:

Task 1. Implement the double circular linked list;

Task 2. Implement the node deletion;

Task 3. Implement the node addition;

Task 4. Locate the node in linked list ;

Task 5. Display information from linked list ;

Task 6. Demonstrate correct use of dynamic memory allocation;

Task 7. Implement sorting algorithm;

Task 8. Graphically explain how program works according to the implemented

program code

Task 9. Calculate memory size required to perform the program before, during and

after dynamic memory allocation;

Text file (input)

Room Number First name Surname Price for room Price for breakfast Number of nights

205 Andie MacDowell 65 2.5 3

516 Albert Einstein 105 6.4 10

204 Antoine Bruno 63 2.3 1

215 William Shakespeare 264 2 4

395 Julia Roberts 763 19.5 12

254 Michael Douglas 235 8 3

439 Hugh Grant 165 24.5 4

My code so far:

## Deliverables

#include <iostream.h>

#include <fstream.h> //the library is used to declare variable type of ifstream

#include <stdlib.h>


// definition of structure guest

struct guest


int roomnumber;

char FirstName[50];

char Surname[50];

double priceofroom;

double priceofbreakfast;

int numberofnights;

guest* NextP;

guest* PreviuosP;




void main()


guest *HeadP;

guest *CurrentP;

CurrentP= new guest;


// declaration of variables

// declaration of ifstream name of infile

ifstream infile ("[url removed, login to view]" , ios :: in);

if (!infile) //check if we are able to open file


cout<<"Unable to open the input file"<<endl;





for (int i=0; i<7; i++)


//input data from file

infile >> CurrentP->roomnumber;

infile >> CurrentP->FirstName;

infile >> CurrentP->Surname;

infile >> CurrentP->priceofroom;

infile >> CurrentP->priceofbreakfast;


CurrentP->NextP=new guest;




//check if we have reached end of file

if ([url removed, login to view]() !=EOF)

//cout<<"Somethig very wrong with input: there are still some data infile"<<endl;

[url removed, login to view]();

// Check if data have been entered correctly

cout <<"Data entered from file :" <<endl;


for (int i=0; i<7; i++)


cout << CurrentP->roomnumber << " "

<< CurrentP->FirstName << " "

<< CurrentP->Surname << " "

<< CurrentP->priceofroom << " "

<< CurrentP->priceofbreakfast<< " "

<< CurrentP->numberofnights << endl;



// create file object and open file

ofstream outFile ("[url removed, login to view]" , ios :: app);

if (outFile.is_open())


//get room information

//write record to file

//guest Newroom[7];

outFile << CurrentP->roomnumber << " \t "

<< CurrentP->FirstName << "\t "

<< CurrentP->Surname << " \t "

<< CurrentP->priceofroom <<"\t"

<< CurrentP->priceofbreakfast <<"\t"

<< CurrentP->numberofnights <<endl;


//close file

[url removed, login to view]();




cout <<" File could not be opened. " << endl;


// print out list


[url removed, login to view]();

cout<<"list of Guests by room in ascending order\n";

//need to be continued

[url removed, login to view]();


## Platform

Kemahiran: Kejuruteraan, MySQL, PHP, Kejuruteraan Perisian, Ujian Perisian, Latihan, Pengehosan Web, Pengurusan Laman Web, Ujian Laman Web

Lihat lagi: sorting in data structure, sorting in algorithm, sorting data structure, sorting algorithm in data structure, node data structure, morgan & morgan, michael smith, list of data structure, list in data structure, list data structure, linked n, linked list in data structure, linked list data structure, linked it, linked int, linked i, john roberts, john price, ios definition, int size c

Tentang Majikan:
( 0 ulasan ) Kenya

ID Projek: #3223698