Forum: C++ Aug 7th, 2009 |
| Replies: 1 Views: 349 How do you erase an element thats inside a map. Not the key but the element the key is pointing to? This doesnt seem to be doing what i want it to.
map<int, vector<int> > my_map;
map<int,... |
Forum: C++ Aug 6th, 2009 |
| Replies: 7 Views: 501 Thanks for the reply ancientdragon, that seems like something I can work with. Should I not be using vectors for this? |
Forum: C++ Aug 6th, 2009 |
| Replies: 7 Views: 501 Ok so here is some more code, it has the idea of what i want to do with my program.
#include<iostream>
#include<string>
#include<vector>
using namespace std;
class Set |
Forum: C++ Aug 6th, 2009 |
| Replies: 7 Views: 501 I was wondering if you guys might help me figure out how to make a vector of vectors like so,
The user will name the set say 'A'. And then using 'A' as a key you can then find the set name and... |
Forum: C++ Aug 6th, 2009 |
| Replies: 4 Views: 299 I have a vector which i wish to fill with char's, so that each char is then a pointer to a vector.
vector<char> list;
list[0] = 'A';
list[1] = 'B';
How do I make 'A' and 'B' pointers to... |
Forum: C++ Jun 13th, 2009 |
| Replies: 5 Views: 278 Yeah thats what im trying to do, get it to go through all the levels of the tree until it finds the first null child. I thought like a preorder traversal implementation would do the trick...but its... |
Forum: C++ Jun 13th, 2009 |
| Replies: 5 Views: 278 Yeah this works...I meant I want it to stop after it finds the first null child. I cant figure out how to do it. |
Forum: C++ Jun 13th, 2009 |
| Replies: 5 Views: 278 I want to find the first null child in a tree and return that node of the tree.
Im thinking something like this but it doesnt seem to work the way I want.
node *Find_Empty_Node(node* root)
{... |
Forum: C++ Jun 11th, 2009 |
| Replies: 6 Views: 473 I want the minimal pointer because it is the left most node for my tree. If i have it how do I get it in a variable like this-
root->children[0] = get_lowest(root) ? |
Forum: C++ Jun 11th, 2009 |
| Replies: 6 Views: 473 Yeah the node type def is this
struct node
{
vector <node*> childrent;
int item;
}; |
Forum: C++ Jun 11th, 2009 |
| Replies: 6 Views: 473 IF i have this function...
node* get_lowest(node* root)
{
node* min = root->child[0];
for(int i = 0; i<root->child.size();i++)
{
if(min > root->child[i]) |
Forum: C++ Jun 9th, 2009 |
| Replies: 8 Views: 303 Here is the whole thing...
class Tree
{
public:
Tree() { root = NULL; }
bool isEmpty() const { return root==NULL; }
void insert(int, int); |
Forum: C++ Jun 9th, 2009 |
| Replies: 8 Views: 303 Something like this?
void Tree::insert(int num, int num2)
{
node* insert = new node;
insert->item = num;
if(isEmpty())
{ |
Forum: C++ Jun 9th, 2009 |
| Replies: 8 Views: 303 Ah yeah that was just a blind man that didnt notice that. But now, how would I check for an open node?
void Tree::insert(int num, int num2)
{
if(isEmpty())
{
root = new node;... |
Forum: C++ Jun 9th, 2009 |
| Replies: 8 Views: 303 Would someone be so kind as to help me with this insert. The function insert takes two numbers, num and num2. num is the number to insert in the tree and num2 is the number of children to the... |
Forum: C++ Jun 5th, 2009 |
| Replies: 5 Views: 337 So If i had this how would I keep track of the root children?
#include<iostream>
#include<vector>
using namespace std;
class Tree
{ |
Forum: C++ Jun 5th, 2009 |
| Replies: 5 Views: 337 So in a binary tree the insertion looks something like this:
void btree::insert(int num)
{
if(root!=NULL)
{
insert(num, root);
}
else |
Forum: C# Apr 17th, 2009 |
| Replies: 7 Views: 4,428 I tried that new bit of code and it just prints out the same line twice, which is row 3 when it should print out rows 3 and 4. Here is the code im working with..I added another row, so there are two... |
Forum: C# Apr 16th, 2009 |
| Replies: 7 Views: 4,428 Yes JerryShaw thats exactly what i was looking for, thanks! Just curious what if I wanted to find more then one row that had the name "Lance" in it? |
Forum: C# Apr 16th, 2009 |
| Replies: 7 Views: 4,428 How would I find a row with a column value? Say Im looking for people with the name "Lance" then once ive found Lance display the row of info for lance. Ive tried using select but cant seem to get... |
Forum: C# Feb 20th, 2009 |
| Replies: 3 Views: 357 is there a way to pass in numbers(int) like this?
somename([0,0],[2,4],3);
thanks for any help |
Forum: C# Feb 11th, 2009 |
| Replies: 4 Views: 528 Is it possible to input numbers into two different arrays like so,
1 2 3 4 5 6 7 8 9
where the first array would hold {1, 3, 5, 7, 9}
and the second array would hold {2, 4, 6, 8}? |
Forum: C# Feb 10th, 2009 |
| Replies: 1 Views: 311 I want to enter in a bunch of integers like so:
1 11 2 12 3 13 4 14 5 56 6 80...
How would I get them into an array of int?
Console.WriteLine("Enter in numbers");
string answer =... |
Forum: C# Feb 5th, 2009 |
| Replies: 1 Views: 601 Trying to make a circular queue, but its not working right. Enqueue is just adding things to the end, every time.
my output is:
Numbers in Queue: 1 2 3
Numbers in Queue: 2 3
Numbers in... |
Forum: C# Jan 30th, 2009 |
| Replies: 4 Views: 480 |
Forum: C# Jan 30th, 2009 |
| Replies: 4 Views: 480 Im trying to make a circular queue. Why does empty keep saying my q is empty?
using System;
namespace CQueue
{
class Program
{
static void Main(string[] args)
{ |
Forum: C++ Dec 2nd, 2008 |
| Replies: 6 Views: 644 Well that sort of works but if the char I want to delete/erase is at the end of the string my compiler crashes. I dont understand how to delete/erase a char that is not an alphanumeric type.
... |
Forum: C++ Dec 2nd, 2008 |
| Replies: 6 Views: 644 How would I delete one char from a string?
string aWord = "question?";
while(aWord[i])
{
if(isalpha(aWord[i]))printf ("character %c is alphabetic\n",aWord[i]);
else
delete[i]aWord;
... |
Forum: C++ Nov 26th, 2008 |
| Replies: 3 Views: 349 If I had a text file with words like this:
word* (start) enable! get&& Words
it would just find the A_Z characters...like this:
word start enable get Words |
Forum: C++ Nov 26th, 2008 |
| Replies: 3 Views: 349 Does anyone know how to search a text file for just alphanumeric words using regex? And could you show me? |
Forum: C++ Nov 25th, 2008 |
| Replies: 6 Views: 727 yes this does run, and setting frequency to zero and determining if a word is already in the tree then incrementing it, is what I need help on. |
Forum: C++ Nov 25th, 2008 |
| Replies: 6 Views: 727 Im trying to count the frequency of words from a file and cant seem to get it to work. My frequency function recognizes the word is there but doesnt return a count for each word yet. The text file... |
Forum: C++ Nov 2nd, 2008 |
| Replies: 3 Views: 464 Im having trouble turning this function into a recursion function, partly because I did it another way and now I cant think of how to do it recursively. Can you help?
int list::recursion(int... |
Forum: C++ Oct 26th, 2008 |
| Replies: 6 Views: 471 Maybe if you run this you will get it better. I need to fill in each "box" with the three numbers. But I need to get to each box with recursion. So if I have an 8 by 8, i need to look in the... |
Forum: C++ Oct 26th, 2008 |
| Replies: 6 Views: 471 Im having trouble seeing this recursion function through. Say I have an 8 by 8 array how would I get the search function to "see" into the middle of the 8 by 8 array. Positions (4,4),... |
Forum: C++ Oct 12th, 2008 |
| Replies: 3 Views: 392 is there a way to not put in integer 3? And just get number.one and number.two into the next function? |
Forum: C++ Oct 12th, 2008 |
| Replies: 3 Views: 392 Say you have a class called example:
class example
{
int one;
int two;
};
and you use this to get numbers from the user: |
Forum: C++ Oct 10th, 2008 |
| Replies: 8 Views: 485 I dont want to cout the char I want pointer[a][b] to be the char. |
Forum: C++ Oct 10th, 2008 |
| Replies: 8 Views: 485 When I insert a char like '*' I get a number in the output. |
Forum: C++ Oct 10th, 2008 |
| Replies: 8 Views: 485 How do I insert a character into a number array? Is it possible? a and b are constants.
for(int i = 0; i <n; i++)
{
pointer[i] = new int[n];
}
for(int i=0;i<n;i++)
{... |