C/C++ :: Make Circular List And Print It
Apr 28, 2015
I have this program. I am trying to do this Circular List but i think something going wrong. The first of all is the list.The second is if my code for delete and select function are correct and the third i would like my program getting a "n" number of names and then make the circural list then print it and then when i select a number delete every node until give us the only one left.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 10
#define NUM_PER_LINE 6
typedef struct node {
char name[SIZE];
struct node * next;
[Code] .....
View 1 Replies
ADVERTISEMENT
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
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
Dec 2, 2014
Should my if statement be
if (tail== NULL) or if(tail->next == tail) ?
View 4 Replies
View Related
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
Nov 30, 2014
Why is it sufficient to only have a pointer to the last node of the list?
View 3 Replies
View Related
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
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
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
View Related
Nov 25, 2014
I'm having some issues with my code. For the produce function i am getting an error saying 'no instance of overload function produce() matches the argument list' and also for the lines buffer[head].data = message; buffer[head].time = current_time i get an error saying 'expression must have pointer to object type.
In the code i'm not sure if i passed the variables to the function correctly. I have attached the code .....
code produce.txt
View 14 Replies
View Related
Aug 27, 2014
i am using turbo c++ my program is based on maths equations and my final answer is 918 or any 3 digit number only but i don't want 918 to print instead i want only 18 to print. this program gives different output for every different input so i can't just minus 900 from it and get 18. i just want that no matter what 3 digit number is the answer,i just get the 2nd and 3rd digits while printing it and not the first.
the final answer giving equation is:-
f=2914-1996
where f is my answer and its 918
but i want it to print as 18 not 918
View 1 Replies
View Related
Nov 24, 2014
I'm trying to make a program in C where the user enters a string and it prints a word for example (name) in lowercase then the same word again but in capitals and lowercase like this (NnAaMmEe).
my code is below;
#include<stdio.h>
#include<ctype.h>
int main()
[Code].....
View 1 Replies
View Related
May 26, 2013
How can I make the output print out to the screen in reverse?
Code: #include <iostream>
#include <iomanip>
using namespace std;
int getnum();
void Fibonacci(int n);
[Code].....
View 7 Replies
View Related
Oct 26, 2013
I want to make a simple program that will print out the factors of an integer. My program right now only outputs "The prime factors of 221 are 221, 221, 221, 221"... Where it should be "The prime factors of 221 are 1, 13, 17, 221"
#include <cstdio>
int factorsOf(int x);
//function
int main() {
int x = 221;
printf("The factors of 221 are ");
[Code]...
View 3 Replies
View Related
May 13, 2012
I am trying to read from a data file that has input as :
12.0, 11, 123
14.0, 12.1, 3
And I want the program to read the data from the file and then make it into an array of structures and then print that array afterwards.
Code:
#include <stdio.h>
#include <stdlib.h>
#define MAX_INPUT 1000
int n =0;
int i = 0;
typedef struct {
double x[MAX_INPUT];
[Code] .....
The program when run gives the following output:
Ishtiaque-Mohammed-Khans-MacBook-Pro:Comp20005 IshtiaqueMKhan$ gcc -Wall -ansi -o ProjectB ProjectB.c
ProjectB.c: In function "main":
ProjectB.c:59: error: incompatible type for argument 1 of "print_array"
View 1 Replies
View Related
Apr 6, 2013
How can you make a linked list without having to write
node *head = NULL;
head = new node ( "zildjian" );
head->next = new node ("sabian");
head->next->next = new node ("paiste" );
View 4 Replies
View Related
Mar 8, 2014
i want to make a function that returns a list of strings
i have this code in vb.net
Public Class Addonloader
Public Enum AddonType
IGraphicalAddon = 10
[Code]...
but when i try to debug it, i get this error
"Expected class, delegate, enum, interface, or struct"
and it underscores list <system.type>
View 2 Replies
View Related
Sep 5, 2013
How can i made a Drop down list in SFML ? This drop down list contains names of different animals...
View 10 Replies
View Related
Apr 28, 2014
If I wanted an int connected to a float connected to a string connected to a POD, would all I have to do is :
Code:
template<class T, class X>
struct node {
T data;
node<X> *next;
};
Or would I be forced into using polymorphism?
View 10 Replies
View Related
Jan 9, 2015
OK I'm making a simple program to make a shopping list. I would like the program at start up to load the previous shopping list that was saved as a text file. The format is one line per entry which consists of the category or Isle, and the item description. Here's an example:
3 Dog Food
Produce Sweet Onions
I reading the first word, and then I want to read the rest of the line which may have more than one word... the problem is my code hangs... or goes into the old infinite loop. It doesn't see the end of file.
Here is my code:
void
addItemsFromFile(vector<item> &shoppingListVector) {
string word;
char buf[30];
if (fileExists("shoppinglist.txt"))
[Code] .....
View 3 Replies
View Related
Dec 21, 2014
I'm writing a program where the user inputs a number of rows, and that many rows of @ symbols are printed, where the first row has the same number of columns as rows, and each next row decrements the number of columns by 1. It prints out a totally wrong output and whatever I try it won't print the right thing- currently when I input 4 it prints out 5 @ symbols on the first row, and then 3 on all the other rows.
Code:
#include <iostream>
using namespace std;
int main ( ) {
int rows;
cout << "How many rows? ";
cin >> rows;
[Code] .....
View 2 Replies
View Related
Aug 26, 2013
I was assigned to print a linked list but as a vector of char (I cannot use the normal string type) , this is what I have:
char* List::asString(){
Node* ite = new Node();
ite= first;//ite is like an iterator of the list
for(int i=0; i<sizeOfList; ++i){//sizeOfList is the total of node of the list
[Code] ....
But when I print that, I get a bunch of weird symbols...
View 7 Replies
View Related
Oct 17, 2013
So for class I have to make an array of structures for a basic contact list in a phone.
I understand the bones of the program and how to go about doing most of it but as far as arrays of structures go I am blind.
Code:
struct phone
{
char FirstName[16];
char LastName[16];
int Number[11];
};
struct phone numbers[friends]; //friends is a variable assigned by the user What I am a bit confused about is say the user enters 30 as how many friends they have. How would I assign a value to the 3rd struct for LastName?
View 3 Replies
View Related
Feb 10, 2015
I am trying to make a linked list. When I compile my code, I get an error saying 'current' is not declared in this scope. I don't understand because I have declared in the first line of my functions body. The variable is local to the function so I don't understand what the problem is.
#include <iostream>
#include <cstdlib>
using namespace std;
class LinkedList {
public:
LinkedList() // default constructor makes an empty list
[code].....
View 2 Replies
View Related
Mar 11, 2014
I have two arrays:
const char *mymp3list[15] = { "Song 1", "Song 2", "Song 3", "Song 4", "Song 5", "Song 6", "Song 7", "Song 8", "Song 9", "Song 10", "Song 11", "Song 12", "Song 13", "Song 14", "Song 15" };
const char *myFriendsmp3list[20] = { "Song 1", "Song 2", "Song 3", "Song 4", "Song 5", "Song 6", "Song 7", "Song 8", "Song 9", "Song 10", "Song 11", "Song 12", "Song 13", "Song 14", "Song 15", "Song 16", "Song 17", "Song 18", "Song 19", "Song 20"};
And I want to compare the two arrays and print out a list of all the "songs" without repeating any.
I've figured out how to print the just the duplicates using:
for (int count = 0; count < SIZE1; count++){
for (int i = 0; i < SIZE2; i++){
if (mysonglist[count] == friendsonglist[i])
cout << mysonglist[count] << "";
}
}
But I'm stumped on how to print a full list containing no duplicates.
View 4 Replies
View Related
Feb 16, 2013
void search(int srch) {
if (isempty()) {
cout<<"No Record Found";
} else {
node *p;
p=head;
while(p!=NULL || p->getroll_no()==srch)
[Code] ....
View 1 Replies
View Related