70 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for existinglady

hello, can someone help me, when I put the codes from my book and edited them to use filestream, I encounter an error #include <iostream> #include <fstream> #include <string> using namespace std; struct nodeType { string info; nodeType *link; }; int main() { nodeType *head = NULL; nodeType *newNode; nodeType …

Member Avatar for Roy_264
0
6K
Member Avatar for brandon66

Im trying to implement queue with a linked list i think i have the enqueue function correct but im having problems with the dequeue. I can get it to delete the first number but then the rest of the list is empty can someone point me in the right direction? …

Member Avatar for brandon66
0
244
Member Avatar for Bradoz

Hello below is my code for a program that reads in integers rom keyboard input and creates two polynomials from that input and then does some maths functions on them. I've got the addition working, having trouble with the multiplication though. Any help would be appreciated. thanks import java.util.*; import …

Member Avatar for JamesCherrill
0
3K
Member Avatar for Stefan_2

Okay. This weeks 'problem' is that I need to simulate a game. I have to make two singly linked lists which will contain a name of player, his attack (double/float) number and his defence number and so on for as many players as the user inputs. The point of the …

Member Avatar for Stefan_2
0
322
Member Avatar for Pyler

I'm trying to implement a hangman game using linked lists but not getting anywhere. I want guessed characters to be inserted in a Linked list of chars at a position that corresponds to the character's position in the word they are trying to guess.(See example at bottom.) For some reason …

Member Avatar for JamesCherrill
0
2K
Member Avatar for eldiablo1121

Hello, I have to write a program that will solve polynomials by user input, my program compiles, but gets an exception error. Here is my code: import java.io.*; import java.util.Scanner; import java.util.LinkedList; public class PolynomialList { private Node first = new Node(0, 0); private Node last = first; private static …

Member Avatar for JamesCherrill
0
1K
Member Avatar for zaxo311

So here's my problem I have inner structure inside of client. How can I know while reading from txt file that I'm reading item data or client data for my list? struct item { char item_name[30]; char item_state[30]; float item_price; char item_status[30]; float item_price_if_not; struct item *next; }; struct client …

Member Avatar for zaxo311
0
9K
Member Avatar for zaxo311

I'm trying to make make project for my programming class. All that's left is deleting elements and editing elements. Basicaly my question is how would I do it for my inner list? Or how would I delete single client from list? Would I first have to free the client's inner …

Member Avatar for zaxo311
0
423
Member Avatar for zaxo311

Im writing project for my programming lessons and right now got some problems with output from function AddItemToClient, basicaly its mainly with date, in first node its correct one but after this its just random. Could someone explain what I'm doing wrong here? #include <stdlib.h> #include <time.h> #include <string.h> #include …

Member Avatar for zaxo311
0
934
Member Avatar for zaxo311

I have following problem: I have 2 structures: Clients and items for example structure clients would have name and list of items from another structure asigned to this specific name I have to do this with singly linked lists. I simply have no idea how to do this would be …

Member Avatar for zaxo311
0
429
Member Avatar for nadiam

so this piece of coding is having a problem. namely the search funtion. it will search but the result would only be the first element. the second will not be seached. like for example first element is lily and second element is john. search for the name lily will result …

Member Avatar for Ancient Dragon
0
4K
Member Avatar for yann.bohbot.9

Hey everyone, I posted recently an issue that was almost resolved but I have a similar question but have different variables. I'm really new to C and I'm a bit confused. Like I said on the other post I need to seperate a string using strtok() and store the seperated …

Member Avatar for Ancient Dragon
0
250
Member Avatar for TalentedIndividual

hello fellow programmers, i am doing an assignment for class and i am having a bit of trouble. So the assignments reads Given two sorted (in ascending order) lists of size M and N, write an O(M+N) algorithm to find the sorted (also in ascending order) union of the two …

Member Avatar for tinstaafl
0
519
Member Avatar for kyle.mace.35

Alright so my problem is I am getting an error that says undefined reference to all of my functions related to DoubleLinked, DoubleLinked<string> dict, dict.add, etc. If anyone knows why that would be great. Thank you. Oh and if i add () to DoubleLinked<string> dict then i just have undefined …

Member Avatar for kyle.mace.35
0
381
Member Avatar for strizh

I'm having problem with passing argument to the linked list. I wait for user input then I parse this user input and put parsed tokens into dynamic array (char **c) After that I need to write ceratin user input into linked list (for example I need to pass c[1] to …

0
130
Member Avatar for Hojjat.Mojallal

Hi I've tried the code below to merge 2 linked list which f1 and f2 are the first nodes in the initial lists and the "first" is the first node in the result list. But it doesn't work! [CODE] node *merge(node *first,node *f1, node *f2,int n1,int n2){ int n=n1+n2; while(n-- …

Member Avatar for mandeepsukhwinderparmar
0
4K
Member Avatar for FUTURECompEng

Currently this method has a run time of O(N^2) and I am trying to get it to O(N). Any suggestion as to where I should start? public void removeAll(e removeNum) { node nodeToFind = this.find(removeNum); while(nodeToFind != null) { this.remove(nodeToFind); nodeToFind = this.find(removeNum); } } Thanks

Member Avatar for JamesCherrill
0
296
Member Avatar for FUTURECompEng

I am trying to input an int into the end of a singly linked list. I have already created the code to put a number at the end of the list but when I go to print it out, it only prints out (in my test class) the int that …

Member Avatar for jalpesh_007
0
303
Member Avatar for rhowell

I'm working with some old code and the users tell me that the original program's output was a single binary file containing multiple stuct data. The output I get is a binary file containing a single structure. The comment also indicates that this what is happening but I need to …

Member Avatar for poornamoksha
0
221
Member Avatar for Dean_williams

Hello. I am having a tough time understanding the concept of double linked list. For now, i understand double linked list has 2 links, one forward and another one previous. data is in the middle. when inserting must check where to insert. if previous is equal to null, then can …

Member Avatar for Dean_williams
0
229
Member Avatar for Kristjon

Hello guys ! Hope you're doing well. I have faced a problem in declaring linked lists inside a linked list. I made a picture because it speaks more than 1000 words ![list1](/attachments/large/3/list1.JPG "list1") Here's my structure declaration: typedef struct author *link; struct author { char name[20]; link next; link down; …

Member Avatar for Kristjon
0
322
Member Avatar for alaa sam

Hi everyone well currently I am working on a simple malloc and free implementation but I am facing some problems . I get a segmentation fault this is my output inserting node 0 0xc87000 inserting node 1 0xc87014 inserting node 2 0xc87028 inserting node 3 0xc8703c inserting node 4 0xc87050 …

Member Avatar for alaa sam
0
209
Member Avatar for eggsandbacon

Hey everyone, I'm working on an assignment and I'm having some trouble figuring out how to implement two operators. The program creates and implements a class to represent the Stack ADT using a singly-linked list. There is a driver program to test my implementation. I have everything implemented (except the …

Member Avatar for aranayd
1
1K
Member Avatar for dancks

So, I'm using allegro game programming library. Before I move on to bigger and better things I wnat to get a handle on pointers. Specifically with things like structs, linked lists and maybe binary trees in the future. I posted a program that uses a linked list to keep tracks …

Member Avatar for dancks
0
301
Member Avatar for sonicx2218

import java.util.*; import java.io.IOException; import java.util.Scanner; import java.util.Random; public class LinkedListProgram { public static void main(String[] args) throws IOException { int i,number, ran; Scanner sc = new Scanner(System.in); LinkedList<Integer> list = new LinkedList<Integer>(); ListIterator li; String line; Random random = new Random(); int pick = random.nextInt(150); System.out.println("Enter # of nodes"); …

Member Avatar for sonicx2218
0
3K
Member Avatar for sonicx2218

So my java class is a joke, and we're expected to learn how to do our assignments via the web...I'm a hard worker, but I'm just not good at this. [Assignment pic](http://oi50.tinypic.com/aw3zx2.jpg) There's the assignment image. I think i got how to do the first part with the adding random …

Member Avatar for sonicx2218
0
542
Member Avatar for Griff0527

I have pretty much failed my class (4 weeks behind in an 8 week class that is currenlty at the beginning of week 8), but I am wanting to learn C++ for myself anyhow. I have visited http://www.cplusplus.com/doc/tutorial/ and gone through the tutorial, but cannot understand this assignment. I have …

Member Avatar for Lerner
0
2K
Member Avatar for hwoarang69

iam trying to store all the data in to a struct so i can change it later. //this data is in file abc 1 11 22 def 2 33 ghi 0 22 11 33 asd 2 i was planing on making a array of structs. so 1st line will have …

Member Avatar for hwoarang69
0
220
Member Avatar for while(!success)

Hey guys, I am writing a program which uploads a text file into a linked list then displays a menu prompt to the user. All of my functions work fine except when I try to exit the menu/program. The program crashes and I don't see where it is coming from. …

Member Avatar for while(!success)
0
239
Member Avatar for abed1986

Hello everyone, I have a program that intends to create a doubly linked list of structures, using the following header (q1.h): [CODE=c]typedef struct lNode* ListNodePtr; typedef struct lNode { char* string; ListNodePtr next; ListNodePtr prev; } ListNode; [/CODE] This is my implementation: [CODE=c]#include "q1.h" #include <stdio.h> #include <stdlib.h> #include <string.h> …

Member Avatar for abed1986
0
803

The End.