Search:

Type: Posts; User: Dontgiveup

Page 1 of 5 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    45
    Views
    18,609

    Yeah you are right. We are using an old one and I...

    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.
  2. Replies
    45
    Views
    18,609

    Unfortunately, we can't use predefine data...

    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...
  3. Replies
    45
    Views
    18,609

    Thanks, so I guess the answer to my question is...

    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;
    ...
  4. Replies
    45
    Views
    18,609

    Not sure that is a good idea. I think, and...

    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.
  5. Replies
    45
    Views
    18,609

    I know of course that I can use another method. I...

    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...
  6. Replies
    45
    Views
    18,609

    Thanks. I think that is clear. So basically, if...

    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...
  7. Replies
    45
    Views
    18,609

    Yeah thanks, you are right. It was my mistake but...

    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...
  8. Replies
    45
    Views
    18,609

    OK, now am confused. I have a hashtable class,...

    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,...
  9. Replies
    45
    Views
    18,609

    OK, it was my mistake, sorry. Forgot to specify...

    OK, it was my mistake, sorry. Forgot to specify the array size.
  10. Replies
    45
    Views
    18,609

    Thanks. You wrote it's exactly like any other...

    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:...
  11. Replies
    45
    Views
    18,609

    OK. I have got yet more problem now. I want to...

    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...
  12. Replies
    45
    Views
    18,609

    Ok, tried it with non-primitives, and it won't...

    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...
  13. Replies
    45
    Views
    18,609

    Alright. I have just been experimenting around,...

    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...
  14. Replies
    45
    Views
    18,609

    Thanks everyone for your reply. OK, I have now...

    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...
  15. Replies
    45
    Views
    18,609

    And I don't think a boolean will help because...

    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...
  16. Replies
    45
    Views
    18,609

    Thanks, that seems like a good idea. My question...

    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...
  17. Replies
    45
    Views
    18,609

    Enum as array

    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...
  18. Replies
    5
    Views
    3,210

    the rest of the program is pretty long and the...

    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...
  19. Replies
    5
    Views
    3,210

    Quicksort infinite loop

    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...
  20. Thread: Bus error

    by Dontgiveup
    Replies
    3
    Views
    1,049

    Bus error

    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 *...
  21. Replies
    4
    Views
    5,653

    OK, thanks. What if I have: P = new int [3];...

    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....
  22. Replies
    4
    Views
    5,653

    Filling pointer with array value

    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;
  23. Replies
    7
    Views
    980

    Thanks all. Yeah that was the Problem.

    Thanks all. Yeah that was the Problem.
  24. Replies
    7
    Views
    980

    Well isn't the operator+ a member function of the...

    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?
  25. Replies
    7
    Views
    980

    Matrix operator+ problem

    I have this program that I am using to add 4*4 matrices:


    #include<iostream>
    using namespace std;

    class Matrix {

    double x[4][4];
Results 1 to 25 of 102
Page 1 of 5 1 2 3 4