Yes, the problem was using a non-const iterator in a const function. Thanks. Also used Caligulaminus code in place of mine; that is working too.
Type: Posts; User: Freddy92
Yes, the problem was using a non-const iterator in a const function. Thanks. Also used Caligulaminus code in place of mine; that is working too.
Hi guys, as the title states, I'm having some trouble going through a map of maps and printing out all of the values. Here is my declaration of the map:
map<T, map<T, int> > adjList;
And...
Edit: Title supposed to be "Is there a point", sorry.
So my book has this example program meant to show how to use stacks and queues. It uses a stack to determine if a group of characters in a...
Edit: I fixed my initial problem, but now I am getting this linker error that I can't figure out:
Hi guys, I'm trying to make a template linked list class, but I keep getting this error when I try...
Well, I probably should have included what I'm thinking the answer is, because I guess I do look like some idiot trying to get a free answer. The > operator will be called, and then if Item is not a...
Preparing for my 2nd semester C++ class final here, and this is one of the practice problems we have:
//Consider the following defnition:
template<class Item>
Item maximal (Item &a, Item...
I'm working on a program that reads in values from a file 3 at a time and stores them separately in a vector. I keep getting this error when I run the program, and I can't figure out why. The class...
For my program, I'm trying to overload the << operator and make it a friend of the Template, but I'm getting an error when I try to build the program. My book does not at all cover how to do this,...
Thanks a lot, that really helped. I got my problem all fixed up and my whole program is working now. Thank you good sir!
So, I have to use the same return type and parameters as functions I'm trying to override? I didn't think that that's what I learned, and I can't find an example of this anywhere in my book. Could...
So basically I'm making a program that has a Vehicle abstract base class and derived classes Truck and Car. From my understanding, a derived class must simply override all pure virtual functions in...
Well, I'll be darned. Thank you for the nice explanation, it's working now.
I thought that it was doing that with the set_fraction function it called. Is it not?
So I'm pretty new to classes in general, and I'm just now making my first attempt at a class with dynamic memory allocation. I made a Rational class that does arithmetic on fractions, with private...
Thanks for the responses. I fortunately was able to find my error and the program now works. The only problem I had left was not including the [] in my deletes of arrays. I did it in one case but...
I am trying to get a program I wrote to work but I am having a problem. The program is supposed to make use of multiple levels of indirection so that I can get more familiar and comfortable with...
Sorry for the double post, I just have another question and didn't see an edit button.
I was trying to figure out when it would be legal to use the ++ operator on an array. For instance, if you...
Thank you very much.
Given the following program :
#include <iostream>
using namespace std;
struct quest
{
int * ptr;