I am creating a to-do list application and to store the tasks on the list, I am trying to create a linked list. the code for it so far is as follows:
public class Node //Class for nodes which make up a linked list {
//Declaring the data to be stored in each node and next variable to point to the next node
public string title;
public string description;
public string priority;
public string finish;
public string complete;
[Code] ....
The problem with this arises when I try to create a new node from another class like so:
createForm create = new createForm(); //Creates an object reference to createForm
create.ShowDialog(); //Shows the createTask form for creating a new task
//Declares variables and stores the return value of methods in createForm
string _title = create.getTitle;
[Code] ....
The variables _title etc.. all store values from text boxes as string. However, the code creating the object says the the variables cannot be implicitly converted from type 'string' to 'int'. Why this error is happening??
I'm simply trying to locate possible logic errors because if I could fill this list properly, I can finish my project very easily. This is just a small portion of a very immersive project.
I am trying to create a linked list that holds objects of type Location *. I have Location defined as
I wish to clarify but can not find where to edit the OP. I believe the list is still empty because I attempt to do a simple read through the list by accessing the head and then reassigning the list to the tail of the list. However, the program never enters the while loop
I have a list of integers that i wish to store in some kind of array. However i do not know how many integers are needed to be stored each time i run my program so i therefore cannot define a size for my array.
I have made this program for linked list, but i have one problem with it. I want to make a function that will delete all same values I inuput in the list.
Example: if user inputs 5 I want to delete all 5 for the list. I have tried doing this with the loop inside regular function that erase single value.
This is function that erases single value:
Code: void list::Delete (int a) { node *temp=head; if (temp==NULL) return ; if (temp->getNext()==NULL) { delete temp;
HelI have been tasked with creating a program which (1) takes in integer values from a user (until the user enters -1) and inputs these values into a linked list. This (2)original list is then to be printed out. The program then uses the algorithm "bubble sort" to (3)order the list in descending order before finally printing it out again.
I have managed to do this but I kind of cheated since I do not quite understand how to manipulate a linked list. What did was I took the values in the linked list and transferred them into an array and then did bubble sort on that array.how to do bubble sort on a linked list as well as how to print a linked list.
Code:
#include<stdio.h>#include<stdlib.h> typedef struct node { int info; struct node *link;
I'm trying to go search through my linked list for a passed string and if it matches, remove it...but obviously link everything back together properly. This is what I have so far but when i pass it to my display function, which is properly working, it goes into an endless loop
I'm trying to make a function that lets me pass an index and a string and will insert the string at that index in the linkedlist... here is so function i have so far:
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?
My program takes in an input file from the command line and converts the string from the file into a linked list and then depending on the command it will manipulate the string to either reverse the list, print the list, or take a character out...I'm having trouble taking a character out, my code compiles fine but doesn't change the string at all
For some reason the integer array, arr[100][50], declared in main is not storing the correct values when passed through the function charArrayToIntArray.
I made an output right in the function to show how the array is not keeping the proper values, although when I output the array from within the loop in the function, it shows the correct values.
I am trying to create a program that will give me an value for a chosen from the user array ut I believe the program I've made does not recognize the values of the previous arrays. (Here is my program):
#include<stdio.h> int main() { int n; int i; int j; float c; float a[10000];
[Code] ....
There must be problem cause every value I give n(only for n=1 the answer is correct) the result is "a[n] is -inf"
I'm supposed to store the value of a countrys population. Then gather out the percentage that countrys population holds when compared with the global population.
Anyway here's the code:
Code: #include <iostream> long swe_pop = 9644864; int main ()
[Code] .....
The result I'm getting is 0%.
I was under the impression that long (or long long) integers could hold high values. And that I could then divide these and answer with a float type value. Giving space for the decimals.
I'm trying to write a function that takes two linked lists and creates a third one with only the common elements.
It assumes the first list (the caller) has no dups, but it doesn't seem to be working. The program doesn't crash, it just hangs when it is supposed to display L3 (the third list)..everything else runs and is displayed fine.
The problem deals with writing a program to geta series of integers from a user and storing those values into an array. Then use a function called selection_sort, when given an array with n elements, the function must sort the array from smallest to largest values.
I have code, and im trying to get it to compile but im getting these implicit declaration errors and conflicting types. Here is my code and the compiler errors.
Code: Compilation started at Sun Feb 10 20:14:48
gcc -Wall -o ex9-1 ex9-1.c ex9-1.c: In function 'main': ex9-1.c:16:5: warning: implicit declaration of function 'selection_sort' [-Wimplicit-function-declaration] ex9-1.c:20:2: warning: implicit declaration of function 'prinf' [-Wimplicit-function-declaration] ex9-1.c: At top level:
[Code] ...
Compilation exited abnormally with code 1 at Sun Feb 10 20:14:49
Code: #include <stdio.h> int main(void) { int a[100], i, j, N; printf("How many numbers will you be entering: "); scanf("%d", &N);
I want it to store the integers as bits so that I am move them over and store them farther down the row as more numbers are added, but instead each new number is being added to the previous and I'm just getting a larger integer. Is this even a feasible way to store integers within an integer?
I have a linked list comprised of chars like so...
Code:
node1 - "p" node2 - "o" node3 - "p"
I need a function that will take in three perameters...node *replaceChar(node *head, char key, char *str)Stipulations of this function. head is the head of the list, 'key' and 'str' are guaranteed to contain alphanumeric characters only (A-Z, a-z, and 0-9). str can range from 1 to 1023 characters (inclusively). So if I call this function with these perameters..
Code:
node *head == /*the head of the list to be examined*/ char key == "p"char *str == "dog"The new list will look like this... node1 - 'd' node2 - 'o' node3 - 'g' node4 - 'o' node5 - 'd' node6 - 'o' node7 - 'g'
All instances of 'p' were replaced with 'dog' I have a toString function which takes in a string and converts it to a linked list and returns the head. So assume that you can call the function on str = "dog" so...
Code:
toString(str) == /*this will return the head to the list made from the str*/
If it's unclear what my question is...I am stumped on how to write the replaceChar function the one that takes in three perameters..
// Write a function called insertEntry() to insert a new entry into a linked list.
Have the procedure take as arguments a pointer to the list entry to be inserted (of type struct entry as defined in this chapter), and a pointer to an element in the list after which the new entry is to be inserted.
// The function dveloped in exercise 2 only inserts an element after an existing element in the list, thereby prenting you from inserting a new entry at the front of the list.
(Hint: Think about setting up a special structure to point to the beginning of the list.)
This is a working version of the exercise, but I don't think I'm doing what's asked. I was able to add an element to the beginning of the list using an if statement, not creating a special structure that points to the beginning of the list. How would I go about creating a special structure that points to the beginning of the list to add a new element at the beginning of the list?
I know how to do this in c++ with fstream and std::string and getline and so on and so forth. Im writing my code solely in c however. I can't get g++ installed so figured it was a good excuse to learn c instead of using the equivalent c++ abstracts.
My problem is, I'm making a game in c that I have made in c++ but have ran into an issue with my map. I want to read in my map from a file which just looks like this: Name of Town * * * * * * * * * * * * * * * * * * * * * etc...
so i tried using fscanf to first read in the name of the town (stored in a char*) then read in the characters (in this case '*')(not including white spaces becuase i can just print those) into another char*. what is the better way to do this?
I am trying to use C# with C++, two different applications that work together.
In C# it is easy to get a byte array out of a string, by just using Encoding.Default.GetBytes(of-this-string);
I can pass bytes to my C++ program by just writing in the embedded resources. But this won't allow strings, as far as I know it can only be a byte array. C++ reads the embedded resources a LPBYTE.
So I try to send the string or message in byteform.
However the problem in C++ is that there is no Encoding.Default.GetString(xxx)
Would there be any other ways to send a message/sentence in bytearrayform and request it in C++ back to the original string?