Yeah you are right. We are using an old one and I don't think the latest one is actually supported on the uni platform. It is fine, though, you work with what you have. Thanks.
Type: Posts; User: Dontgiveup
Yeah you are right. We are using an old one and I don't think the latest one is actually supported on the uni platform. It is fine, though, you work with what you have. Thanks.
Unfortunately, we can't use predefine data structure. This is part of a programming assignment where we are supposed to make our own hashtable (add remove, sorting etc.) using our own functions, STL...
Thanks, so I guess the answer to my question is no. That it is not possible to initialise a dynamic array in an initialisation list. Instead of, as am doing now:
class Test {
bool * test;
...
Not sure that is a good idea. I think, and someone correct me if I am wrong, in C++, unless you assign values, everything remains undefined.
I know of course that I can use another method. I am already using an init method in the constructor body to fill in. But I was thinking of whether it is possible with the constructor (initialisation...
Thanks. I think that is clear. So basically, if you want to initialise a pointer, just initialise it as null and don't initialise it with some other funny stuff.
Is there any way that one can for...
Yeah thanks, you are right. It was my mistake but I managed to sort it out and all is well. Also, can't use vectors because we are not allowed to use that as we have to design our own data structure...
OK, now am confused. I have a hashtable class, this class contains a dynamic array that contains objects. Now, I want to have a way of knowing which index is occupied, deleted, or unoccupied. Before,...
OK, it was my mistake, sorry. Forgot to specify the array size.
Thanks. You wrote it's exactly like any other array. So, in your example we have example, which contains ten elements, each occupied:
State example[10] = {occupied};
now, if I write a loop, like:...
OK. I have got yet more problem now. I want to initialise the enum with default values, but only with one enum value, namely unoccupied. So, will this work? The idea is to make sure that in the...
Ok, tried it with non-primitives, and it won't work because you have to define what = mean for non-primitives (overloading = operator). But another idea befell on me, which seems to also work...
Alright. I have just been experimenting around, and I found something rather strange.
int values[10];
for(int i = 0; i < 10; ++i)
values[i] = i;
Status status;
for(int i...
Thanks everyone for your reply. OK, I have now decided that I need 3 states and two won't be enough, so I guess that means an enum is more efficient and better in this case. Only problem is I haven't...
And I don't think a boolean will help because boolean only has true and false. So, for example I can have a boolean that tells me if a position is occupied or not but not one that can tell me if a...
Thanks, that seems like a good idea. My question is when you write Status status[max_tableSzite]; what does this array contain. Does it contain equal numbers of occupied and deleted? Because when we...
I have this problem. I have a hashtable and I would like to use enum to know which position is occupied and which one had its element deleted.
My enum is this:
Status status;
enum...
the rest of the program is pretty long and the problem seems to be with this function. For example if I try to sort an array with values 666, 4711, and 4294967295, I get an infinite loop. Oh and I...
I am trying to implement quicksort as a sorting algorithm. However, I seem to get an infinite loop. Tried my best to figure it out but couldn't. Any help appreciated. Here is the code.
template...
I am writing a double hashing program and I seem to have a problem here. I get always bus error. I have used std:: cout to print out where exactly the problem occurs and it seems to occur at E *...
OK, thanks. What if I have:
P = new int [3];
this, on the one hand, is an initialisation but also not an initialisation in the sense that we are merely initialising a pointer with 3 integers....
Can someone please explain to me why this does not work?
#include <iostream>
using namespace std;
int main () {
int i;
int n [] = {3, 2};
int * p;
Thanks all. Yeah that was the Problem.
Well isn't the operator+ a member function of the class Matrix? Are operator functions not member methods of a class if declared within that class?
I have this program that I am using to add 4*4 matrices:
#include<iostream>
using namespace std;
class Matrix {
double x[4][4];