C++ :: Use Circular Linked List And Data Structures To Store Tasks

Mar 30, 2014

The program use a circular linked list and data structures to store the tasks.

- Every task should include a task name, a name for the person assigned to it, and the deadline for the task.
- Variables should be dynamic and their sizes should be determined at runtime based on the length of user input.
- You should implement the following functions (with appropriate arguments and return types) for your structure: add(), remove(), search(), and list().
- The add()function should add tasks alphabetically by task name. You do not need to implement any file operations.
- The search() function should be able search for a task by the task assignee name or the task name.
- The list() function should print records to the screen in the order they appear in the circular linked list.
- You should successfully deallocate all of the allocated memory before termination of your program.

View 4 Replies


ADVERTISEMENT

C++ :: Dynamic Data Structures (Linked List)

Oct 26, 2013

I need an explanation of what linked lists are. How the nodes are been defined and used, especially in an object oriented programming. With a code example.

View 1 Replies View Related

C++ :: Creating Circular Linked List

Jan 30, 2015

I've been making a circular linked list and I'm trying to assign each list a "name" and its next "link" but when I run my code it crashes.

Soldier *Head;
Head = NULL;
string names[] = {"Arman","Bogut","Castro","Damascus","Elene"};
for (int i = 0; i < 5; ++i) {

[Code] .....

View 4 Replies View Related

C++ :: Circular Doubly Linked List Code

Feb 27, 2014

When I run this in main it gives me a windows error message. I believe it has something to do with my insertAtEnd function but I've gone over it a million times....

#include<iostream>
#include<string>
#include<vector>
#include"RhymeGame.h"
using namespace std;
Game::Game() {
head = NULL;

[Code] ....

View 3 Replies View Related

C++ :: Adding To The End Of A Doubly Linked Circular List?

Dec 2, 2014

Should my if statement be

if (tail== NULL) or if(tail->next == tail) ?

View 4 Replies View Related

C/C++ :: Reversing A Circular Doubly Linked List

Apr 25, 2015

I print the original list, then reverse it, then try to print it again. Here is what I get when I do that:

So that second line should print 2 1 4 5

Here is the reverse function:

void reverseCirListDeque(struct cirListDeque *q)
{
struct DLink *curr = q->Sentinel;
do{

[Code].....

View 2 Replies View Related

C/C++ :: Pointer To Last Node Of A Circular Linked List

Nov 30, 2014

Why is it sufficient to only have a pointer to the last node of the list?

View 3 Replies View Related

C/C++ :: Add Function To Tail Of A Doubly Linked Circular List

Nov 30, 2014

I have a function that I would like to add to tail. It is not correct.

template<class T>
void DoublyLinkedCircularList<T> :: addToTail(T element) {
DoublyLinkedNode<T>* head;
DoublyLinkedNode<T>* temp;
temp->element = element;

[Code] .....

How do I fix it?

View 14 Replies View Related

C++ :: Doubly Linked List - Circular Dependency Error

May 15, 2013

When compiling the source I get the following error

"pms_program.h:54:56: error: expected declaration specifiers or ‘...’ before ‘CourseType’"

the code you are looking for in pms_course.h ( there is a circular dependency between pms.h , pms_course.h and pms_program.h)

function prototype AppendProgram ( part of doubly linked list )

I have attached the full course code.

As much as I like I cannot change the structure of the startup code ...

please see attached zip file for the entire source code.

View 6 Replies View Related

C++ :: Linked List To Store Student ID And GPA

Apr 2, 2014

So I have to store a student Id and gpa and name in a linked list. I keep getting error messages.

Like: lab 20.cpp(43): error C2628: 'Student' followed by 'int' is illegal (did you forget a ';'?)
(43): error C3874: return type of 'main' should be 'int' instead of 'Student'
(71): error C2664: 'Student::Student(const Student &)' : cannot convert parameter 1 from 'int' to 'const Student &'
Reason: cannot convert from 'int' to 'const Student'
No constructor could take the source type, or constructor overload resolution was ambiguous

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
using namespace std;
struct Student {
string name;
double gpa;

[Code] ....

View 1 Replies View Related

C++ :: Store Information From A File In Linked List

Aug 28, 2014

I'm trying to open a file (contains member information) and store the information in an object, which is then inserted into a linked list. However, the current code just leaves a blank command window hanging with nothing happening.

main.cpp - [URL] ....
MemberProf.h - [URL] ....
MemberProf.cpp - [URL] ....
LinkedList.h -[URL] ....

View 7 Replies View Related

C/C++ :: Using Linked List To Store Guessed Numbers

Apr 26, 2015

Rewriting a program to convert an array based list to a linked list. The program has a user guess a number [1-100] until the correct answer is guessed. I only want to give hints if a duplicate isn't guessed.

while (aGuess-> != p->guess) doesn't work and I haven't been able to troubleshoot myself.

while (aGuess->guess != p->guess) {
if ( aGuess->guess > a ) {
cout << "That's too high -- try again: ";
} // if guess > a

[Code] ....

View 1 Replies View Related

C++ :: Doubly Linked List That Will Store Strings - Delete Function

Sep 23, 2014

I am creating a doubly linked list that will store strings, for example:

struct node{
string data;
node* next;
node* prev;
};

node* head; //first element from left to right (global)
node* tail; // last element from left to right (global)

And here is the function:

void deleteNode(int n){
struct node* temp1 = head;
if (n == 1){
head = temp1->next;
free(temp1);

[Code] .....

View 3 Replies View Related

Visual C++ :: Reading In Data And Displaying Out All Data In Linked List?

Feb 6, 2014

I am wanting to be able to add as many different instances of data, while the user has not stated 'n', but then it only ever writes back to the screen the input for the last set of data. Where as I want to display back to the screen all the data that has been entered.

Code:
#include <iostream>
#include <string>
/*Function Declaration*/
void createItem();
void returnItem();
//Items structure

[code]...

View 6 Replies View Related

C++ :: How To Modify Data In A Linked List

May 27, 2013

I have made a Student record system in c++ using the concept of linked list. The program will take the student id, name and marks for 3 different exams. Then it will calculate the aggregate percentage based on those exams marks and display the relevant message according to the aggregate percentage. All is going well. But there is only one problem. When I modify the student record especially the marks, it doesn't change the aggregate percentage of that specific record. It shows the old one. Similarly the relevant message doesn't change too.


Code:
struct student{
int id;
char name[MAX];
string status;
double aggr;
int matric_marks, inter_marks, entryTest_marks;

[Code] .....

View 3 Replies View Related

C++ :: Search The Data In The Linked List?

Aug 6, 2014

How can I search the data? I want to get the output like this.

============================== Enter a data to search: 44 DATA FOUND! ==============================

Code:
#include <iostream>
using namespace std;
struct node {

[Code].....

View 1 Replies View Related

C :: Data Insertion In Linked List

Feb 9, 2015

I am unable to insert data in a linked lists. Show function is not working.

insert
Code:
#include<stdio.h>
#include<stdlib.h>
typedef struct node{
int data;
struct node *next;

[Code] .....

View 7 Replies View Related

C++ :: Reading Data To A Linked List

Mar 20, 2014

The input is in the following format

5
1 2 9.0
1 3 12.0
2 4 18.0
2 3 6.0
2 5 20.0
3 5 15.0
0
1 5

The first number is the number of vertexes in the graph. Then next lines up to 0 are the edges of the graph. With the first and second numbers being the vertexes and the third being how far the edge is between them. Trying to read in the data and store the edges into there locations in the List adjacency for that vertex. This example would make a graph with five vertexes with edges from 1 to 2&3. 2 to 4&3&1 etc. It also stores in the opposites ex 2 1 9.0.

When reading it in and printing it back out it seems that it is only storing the last data entered for that vertex. EX. When trying to print out the data read in i only get 1 3 12.0, 2 5 20.0, 3 5 15.0, ( 4 2 18.0, 5 3 15.0 would show up if `if(i<n)` was removed it is there so it does not show duplicate edges). what I am doing incorrect?

// CSCI 3300

#include <cstdio>
using namespace std;
struct ListCell
{
ListCell* next;
int vertex;
double weight;
ListCell(int v, double w, ListCell* nxt)

[Code]...

View 1 Replies View Related

C/C++ :: Reading Data From File Into Linked List

Mar 26, 2015

I have a data file that looks like:

111111111
Lisa
Porter
3
ENEE 114
CMSC 412
ENME 515
333333333
Alex
Simpson
1
CMSC 412
***

In the form student ID and then first name last name number of courses and finally the course code(s). Im currently attempting to read these into linked lists with the following code:

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct CourseInfo {
int courseID;
char courseName[30];

[Code] ......

I get no errors or warnings however when i print this out i get:

111111111
Lisa

Lisa
Porter
3
ENEE 114
CMSC 412
ENME 515

And then the program crashes. So i know that for some reason the problem is the

fgets(rootPtr->FirstName, 22, p);

But I do not know why because it seems to work for the other fgets. I also want to know why the while loop never runs and it crashes instead.

View 14 Replies View Related

C++ :: Possible To Copy All Data From Linked List Into Array

Dec 24, 2013

using the following header files:

Code:
#include <list>
#include <map>
#include <iostream>
#include <algorithm>

and

Code:
std::list

If there is a creation of a list, how can one find the sizeof the list. and is it possible to copy all the data from the linked list into an array. Assuming that the data is of type

Code:
char

View 1 Replies View Related

C :: Save Data From Global Variable Into Linked List

Jul 6, 2013

I'm trying to run so called student-administration program.I got functions that can read and write student data, but the one saving the data from about 30 students has some problem that I can't figure. (warning: I'm quite new to C programming)so this is the code:..I guess I can't use global variables as function arguments?

Code:

//global variables
static char ReturnName[31];
static char ReturnFirstName[31];
static float ReturnAverage;
}

[code]....

incompatible types when assigning to type 'char[31]' from type 'int'

View 2 Replies View Related

C++ :: Unable To Modify Object Data In Linked List

Apr 14, 2014

I'm having a problem trying to modify my patient's data. It seems to work, but once the block of code ends it does not save to the linked list.

Problem located in case M.

linked list template header: [URL] ...
patient header: [URL] ...
patient implementation: [URL] ...

#include <iostream>
#include "listTemplate.h"
#include "PatientRecord.h"
using namespace std;
char menu() {
char input

[Code]...

View 1 Replies View Related

C/C++ :: Dijkstra Algorithm - Reading In Data To A Linked List

Mar 20, 2014

Program to implement Dijkstra's Algorithm. Have Problems storing graph info into linked-list . The input is in the following format

5
1 2 9.0
1 3 12.0
2 4 18.0
2 3 6.0
2 5 20.0
3 5 15.0
0
1 5

The first number is the number of vertexes in the graph. Then next lines up to 0 are the edges of the graph. With the first and second numbers being the vertexes and the third being how far the edge is between them. Trying to read in the data and store the edges into there locations in the List adjacency for that vertex. This example would make a graph with five vertexes with edges from 1 to 2&3. 2 to 4&3&1 etc. It also stores in the opposites ex 2 1 9.0.

When reading it in and printing it back out it seems that it is only storing the last data entered for that vertex. EX. When trying to print out the data read in i only get 1 3 12.0, 2 5 20.0, 3 5 15.0, ( 4 2 18.0, 5 3 15.0 would show up if `if(i<n)` was removed it is there so it does not show duplicate edges).

#include <cstdio>
using namespace std;
struct ListCell {
ListCell* next;
int vertex;
double weight;
ListCell(int v, double w, ListCell* nxt)

[Code] ....

View 5 Replies View Related

C++ :: Strcmp On Linked List Data And String Constants?

Sep 28, 2013

why strcmp() doesn't return true when comparing a string constant with a string that was acquired via a linked list. By the way, the data in the linked list was taken from a text file. Does that imply that there's a new line () character in the string from the linked list?

Code:
struct Node{
char ACNO[15];
struct Node *next;

[Code]....

View 1 Replies View Related

C :: Parsing Tokens In File Lines Into A Linked List Of Data

Sep 20, 2013

I have been attempting to store mathematical functions in a file by parsing them into a linked list with a variable sized char ** array as my storage device. I have ran into problems with the memory management detail. The program crashes before output is flushed to the console, so printf() wasn't a debugging option. Neither is my actual debugger, since it seems to get a SIGTRAP every time. I have my warnings turned all the way up, but no errors or warnings are appearing. The part I know works is the actual code that opens the file and gets a line from the file. As far as the two functions that implement the linked list, that is most likely where the problem lies. My current attempt is basically to store the size of the dynamic array in the structure and keep resizing it until there are no more tokens. Then I will store the number of elements of the array in the structure and move on to the next node.

Here is my text file I use :

Code:
sqrt( 25 ); pow( 6 ); sin( 2 );
pow( 4 ); tan( pow( 2 ) ); Main.c :

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct file_data

[Code]...

View 7 Replies View Related

C :: How To Sort Data In Linked List And Arrange Them Highest To Lowest

Aug 12, 2013

i am making a program that reads a file from .txt and print them out using linked list. However, i need to sort them from the highest price to lowest price.

Code:

/* my structs */
typedef struct{
Node *head;
Node *tail;
Node *iterator;
int size;
} List;

[Code]...

i know its long but im afraid that i might miss out some things.

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved