C# :: How To Stack List Items
Nov 18, 2014
I do some research about getting the coordinates from the list items but without success. I would like to make that when i press down my mouse button that little blocks fall "out" my mouse and stack on top of eachother.
that first works. When i press the mouse button i draw squares and the fall to the bottom of the screen, but the stack part not.
here is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
[Code]....
View 14 Replies
ADVERTISEMENT
Sep 26, 2013
Create a program that contains the following functions:
-create two dynamic stacks with integer data contained in an external file.
-Sort items in stacks by the selection sort method
-Record outputs in an external file.
Main function main ()-menu selection functions and check the status of the data
I shouldn`t use arrays or STL only can use vectors but i dont know how to do it howw to make dynamic stack with vectors and how to sort it with selection sort?
View 1 Replies
View Related
Aug 25, 2014
I have this structures:
Code:
typedef struct {{
GList *presets;
} Settings;
typedef struct Preset preset;
struct Preset
{gchar *name;
[Code]...
I want to remove duplicates items in list if them have same freq value.
Example output with duplicate freq:
PHP Code:
name freq unammed 87.80 Radio ZU 92.20 Napoca FM 104.50 unammed 92.20 Rock FM 102.20
Want output:
PHP Code: Europa FM 92.20 unammed 87.80 Radio ZU 92.20 Napoca FM 104.50 Rock FM 102.20
write code to remove duplicates.
View 10 Replies
View Related
Dec 30, 2013
i want to create a program that allows a user to list all create new items, list those items, delete an item, modify an item, search for an item how can i do that This is my work so far
Code:
#include <stdio.h>
#include <string.h>
struct listofitems
char itemName [50];
float itemPrice = 0;
}
[code]...
View 1 Replies
View Related
Nov 22, 2012
I'm supposed to write a program that is able to save a list of items such as books, CDs, or DVDs. The items that are saved must have attributes associated with them. For example a book has a title, author, publisher, and ISBN.
I'm supposed to create a program that is able to save the database of items to a file on the hard drive and also retrieve it from the hard drive.
The user should be able to
1. Enter items
2. Display a list of the items
3. Save the list to disk
4. Read the list from disk
5. Sort the list
6. Exit the program
I know I should use arrays and structs but I don't where to start.
View 2 Replies
View Related
Jan 11, 2013
i want to make a program that accepts 15 items in a singly linked and sorts the nodes.
View 1 Replies
View Related
Apr 1, 2013
I am unable to make any logical algorithm to access middle of stack. I am using stack implemented with linkedlists, I have following functions available for stack like push,pop,top.
View 6 Replies
View Related
Oct 23, 2014
I am trying to program a stack based linked list. Something very weird is happening with my program. Whenever i want to print with cout<< in specific places, it actually changes the data of the stack. Also, using endl after the cout also changes the data of the program.
#include <iostream>
using namespace std;
class node {
public:
int number;
node* nextPtr=NULL;
[Code] ....
View 7 Replies
View Related
May 12, 2014
So im trying to write a code that will take data in from a user and when that user enters specific character then i want to pop the top of the stack and place that node on a new stack. Then if the user enters a different specific character then i want to place what was just popped off the stack back on to the original stack. Anyways i'm just testing what i have without all the complicated stuff with the specific characters, but i get an error and i'm not not well versed in exception handling. So this is what i have so far. the push seems to work well but the pop seems to be giving me problems.
Stack::Stack(){
top = NULL;
bottom = NULL;
}
//method to push a line of text onto the stack
void Stack::push(string data)
[Code] .....
View 4 Replies
View Related
Nov 10, 2013
struct Node {
int entry;
Node *next;
Node(); //1
Node(int item, Node *link = NULL); //2
[Code] .....
Implement: 1 2 3 4 5
and overload operator <<, >>, =
View 1 Replies
View Related
Nov 27, 2014
Basically what are the advantages and disadvantages of having an array implementation vs linked list implementation for a stack?
View 1 Replies
View Related
Nov 29, 2014
I had the following question in my exam paper and only got 2.5 out of a possible 7 marks.
Given the Matrix class:
class Matrix {
public:
Matrix(unsigned r, unsigned c);
Matrix(const Matrix<T>& rhs);
~Matrix();
const Matrix<T>&operator=(const Matrix<T>& rhs);
[code]....
Use the linkedStackType class (Linked list implementation of stack) and write a function reverseRows to reverse the order of rows in the matrix. Note that reverseRows is not a member function of the Matrix class therefore only the public interface of matrix can be used.
template<class Type>
struct nodeType {
Type info;
nodeType<Type> *link;
[code]....
View 2 Replies
View Related
Feb 13, 2013
I'm trying to implement 2d array to simulate linked list for stack and I faced several difficulties doing so.
How do I implement from Top to Bottom ordering? How do I check random index value for validity?
Source-code:
Code:
#include <iostream>
using namespace std;
int myTop, index, nex = -1;
int twoDimentionalArray[25][3], L[25];
[Code].....
And one more thing: how do I get straight 0 from 25 index in the first coulumn?
View 1 Replies
View Related
Mar 20, 2014
I'm a little confused by my programming assignment this week. I've been working at it Wednesday and I've made progress but I'm still confused as to how I'm supposed to do this. The class I made is called Stack, and it's derived from a template class called StackADT. We also utilize a class called unorderedLinkedList, which is derived from a class called linkedList.
We're supposed to implement all of the virtual functions from stackADT in the Stack class. The Stack data is stored in a an unorderedLinkedList, so what I'm confused by is how to implement a few of the Stack functions because there are no functions in unorderedLinkedList which we could call to manipulate the data.
As you can see from my attached code, I'm really confused by how I'm supposed to implement the pop() and top() functions, and I also think my initializeList() function is wrong. We don't have any similar functions in unorderedLinkedList to call, so I'm at a loss of how i'd access my unorderedLinkedList. My initial thought was to call the similar functions in the class that unorderedLinkedList was derived from, linkedList, but I'm unsure of this is what we're supposed to do, or if theres actually a way to access my unorderedLinkedList without having to use the functions from the base class.
NOTE: We're not allowed to modify stackADT, unorderedLinkedList, and linkedList.
Stack.h
#include "stackADT.h"
#include "unorderedLinkedList.h"
template<class Type>
class Stack: public stackADT<Type>{
template <class T>
struct nodeType
{
T info;
nodeType<T> *link;
[Code]...
View 3 Replies
View Related
Mar 10, 2014
I rote this code in my program
JSONNode::const_iterator iter = root.begin();
for (; iter!=root.end(); ++iter) {
const JSONNode& arrayNode = *iter;
std::string type = arrayNode["type"].as_string();
if(type == "node")
[code]......
But when i try to ptint id of second item std::cout<<"Item Id ->>>>>>>>>>>>>" << collection[2].GetId() << std::endl; it gets a blank value. but size of the collection is 82, get the correct value for the collection size.
View 1 Replies
View Related
Mar 9, 2014
I wrote this code in my program
JSONNode::const_iterator iter = root.begin();
for (; iter!=root.end(); ++iter) {
const JSONNode& arrayNode = *iter;
std::string type = arrayNode["type"].as_string();
if(type == "node")
[Code] .....
But when I try to ptint id of second item std::cout<<"Item Id ->>>>>>>>>>>>>" << collection[2].GetId() << std::endl;
it gets a blank value. but size of the collection is 82, get the correct value for the collection size.
View 1 Replies
View Related
Mar 5, 2014
I'm working on creating a windows form with a listbox, textbox, and 2 buttons (add,remove). I need a way of removing every string matching the contents of the textbox from the listbox. Here's what I have:
for (int i=0;i<listBox1.Items.Count;i++)
{
//...
listBox1.RemoveAt(i--)
}
Seems to work, but I need a way to show a error message once the user clicks 'remove' and no items in the listbox match.
View 6 Replies
View Related
Jan 18, 2014
I am creating a student management system (using classes) for my assignment and am stuck with designing UI. I made the classes but am not sure what the best control is to display items from a Dictionary<> object. Right now I am using the ListView because of the columns in details view...just want to know if there is a better, simpler control I could use if i want to display data (without using sql)...or is the good old "next" and "previous" option the simplest?
View 9 Replies
View Related
Oct 21, 2014
im new to programming and new to C, just started with arrays and im somewhat stucked, where i have a .txt file which contains items and prices. I want the items and the prices split into 2 different arrays
The .txt looks like that:
orange 0.89
banana 0.79
apple 0.59
I now want to split the items in a char items[100][100] and float prices[100]. how to split this, preferably with fscanf ?
View 7 Replies
View Related
Nov 6, 2014
I'm creating a program that is combining functions to show a menu to a user then the user picks numbered items which results in the totalling of a bill for them.
Where I'm stuck is after they're entered their selections, how to take them and sum them up. I've been trying with a switch statement, but I'm not sure if this is the right method. Is it even possible to sum separate cases of a switch statement together? Below is the code I've gotten so far:
#include <iostream>
#include <iomanip>
using namespace std;
void showMenu ();
void showBill (double, double, float, double);
void changeDue (double, int);
[Code] ....
View 3 Replies
View Related
Oct 31, 2013
I am writing a program in Visual C++ 10 with 2 forms.
In the first form I have a textbox and a button. The button opens the second form.
In the second form, I have a button that changes the text in the textbox in form1 to an item from a listbox in form2.
Here is my problem. When I do the code for the button in form2 to change the textbox in form1 I get the errors:
error C2065: 'textBox1' : undeclared identifier
error C2227: left of '->Text' must point to class/struct/union/generic type
I thought maybe I should just include the "Form1.h" file but I can't do that because I already included "Form2.h" in form1 in order to be able to open the second form. If I try to include form1 in form2, it says that the code to open form2 is an error now.
My question is, how can I access identifiers such as "textbox1" from other forms and other files when I already used the first form to open the second form? I also want to know how to do this for all identifiers between all files.
how to print the selecteditem from a listbox into a textbox because that doesn't work by just setting them equal either.
Here is my code:
#pragma once
#include "Form2.h"
namespace Test1 {
using namespace System;
[Code].....
View 11 Replies
View Related
Sep 14, 2014
I'm using winforms and I want to set a checkbox on a dropdown menu item, but I don't know how to access the dropdown menu items.
I know ToolStripMenuItem items are attached to ContextMenuStrip items but I'm not sure how to navigate into the ToolStripMenuItem section to read/set those menu items.
ToolStripMenuItem listbox_font_size;
cmsListBox = new ContextMenuStrip();
cmsListBox.Items.Clear();
[Code].....
View 14 Replies
View Related
Aug 31, 2014
I have the following code in which I wish to dynamically delete items out of a vector based on the condition of the item in the vector.
The below code works but throws the error: "vector iterator not incrementable" at certain times.
It seems like this happens when the last item in the vector get's deleted. How do I solve this problem?
for (std::vector<PhysicsObject*>::iterator it = CurrentBoxes.begin(); it != CurrentBoxes.end();/*it++*/) {
(*it)->CalculatePhysicsOrientation();
(*it)->DrawMe();
glm::vec3* CurrentBoxPosition = (*it)->GetCurrentPosition();
if (CurrentBoxPosition->y < -750.0f) {
it = CurrentBoxes.erase(it);
}
++it;
}
View 9 Replies
View Related
Jul 24, 2014
Is there a way to set the height of a listBox to show all of the items without having to kick in the vert scrollbars? I've searched on this question but can't find how to do this.
I want to kind of auto-size my listBox height to accommodate my items (within reason and perhaps set a max height which would kick in the vert scroll bars.
View 9 Replies
View Related
Sep 2, 2013
I'm having problems fully comprehending how to do this task (I'm only going to include my function code since that's the basis of my problem). How should I go about getting my vector to print off 12 items per line. Here's my current function.
void printVec(const vector<int>& v) {
for(unsigned i=0; i < 12;i++)
cout<<v[i]<<" "<<endl;
}
View 2 Replies
View Related
Mar 31, 2013
What codes in c# will output items in a list box?
View 2 Replies
View Related