CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: Zlatomir

Page 1 of 2 1 2

Search: Search took 0.06 seconds.

  1. Re: How to pass structure values between functions

    I updated the function definition and return value (this is because i didn't understood what are you going to return) and you were using cin in the function to read values into some parameters that...
  2. Replies
    4
    Views
    1,951

    Re: Unresolved Externals for Template class.

    Move the definition of Initialize into the header (that contains the declaration of GetValue<T>) and it should work, see this faq for more information:...
  3. Replies
    4
    Views
    1,951

    Re: Unresolved Externals for Template class.

    The only issue i see in the code you posted is that GetValue<T>::Initialize() is not public (or protected) but that shouldn't cause an undefined error, so are you using some "friend-based" mechanism...
  4. Replies
    1
    Views
    1,108

    Re: Need help with extra credit problem

    You are getting the wrong year because tm struct has a particular year representation see the "year format" here: http://www.cplusplus.com/reference/ctime/tm/

    And the random values most likely...
  5. Replies
    21
    Views
    3,415

    Re: problem with boolean

    @GCDEF agree with you that it shouldn't, but it can and there can be some very tricky situations regarding this fact.
    I talk about for example uninitialized bool which can return false if compared...
  6. Replies
    21
    Views
    3,415

    Re: problem with boolean

    No, that is what i tried to explain to you, a bool can store other values, since it is not a single bit (it's 8)

    You need to double the \ to appear:


    cout << "Hello \\n";
  7. Replies
    3
    Views
    676

    Re: Pointer to class example

    Pointers just store the address of a variable, the variable itself can be allocated on the heap or on the stack (if it's allocated on the heap you need to call delete on the pointer to free the...
  8. Replies
    21
    Views
    3,415

    Re: problem with boolean

    An bool in c++ is 1 byte (8 bits) if you store the value 7 in that byte and compare it with the value 1 (true) it will go on the false branch (because those values are not equal) even if they both...
  9. Replies
    7
    Views
    799

    Re: creating variables on the stack

    You can create object on the stack and pass parameters to them, there is no problem there:


    QString stringName("Whatever string you like");


    The only "problem" is when you want the default...
  10. Replies
    3
    Views
    11,482

    Re: Out of bounds array problem

    Just a little suggestion, the exercise sample arrays suggest your class should be a template, so i say you start with a template class from the beginning, so the code should look something like:

    ...
  11. Thread: Header files

    by Zlatomir
    Replies
    2
    Views
    601

    Re: Header files

    It's a naming convention: C++ standard libraries header files don't have the .h extension and also the C standard libraries are named with c prefix and without extension (usually old names like...
  12. Thread: loop question

    by Zlatomir
    Replies
    3
    Views
    541

    Re: loop question

    You need to debug the code and see what selection(files) returns.

    And the difference between the do...while and while is in principle that do..while always executes the do code block at least once...
  13. Re: Error C4430: missing type specifier - int assumed.

    The code is not complete, not the error message (you didn't told us the variable name)

    But most likely the error is about this miss-match:


    class Numbers //here you have the 's'
    {
    public:...
  14. Replies
    3
    Views
    7,020

    Re: Open Source C++ projects

    I don't think that you should start with the reading quite big projects source code, first finish the book, do all the exercises from the book (maybe get other more advanced book) and when you are...
  15. Replies
    26
    Views
    3,460

    Re: Question about C++, compilers

    The original problem was "working" Qt...
    I really recommend to download (and install) the Qt SDK for Windows, witch comes bundled with MingW compiler (and make tool) with qmake (tool specific to Qt...
  16. Replies
    12
    Views
    1,838

    Re: C++0x fails: no multiple return values

    I'm pretty sure that you will not get that "feature", not even in c++2x (or whatever the next standard will be called)

    But if you point a problem where you need that, we will tell you (probably...
  17. Re: Identifying container type in template

    You can do "specialization" for vector<T> something like in this: (just a simple example, but it must compile ;) )


    #include <iostream>
    #include <vector>

    template <typename T>
    class Test{...
  18. Re: Logging all passed Arguments to a Function

    Does the number or types of arguments change?

    If they do, or your _LOG_FUNCTION_ will be generic, you should search for: "perfect forwarding", it's from c++0x, so not many compilers will have this...
  19. Replies
    10
    Views
    992

    Re: Class object construction process

    The data members are constructed in order of declaration in the class definition, so j first and i second, and the syntax: A():i(func1()),j(func2()) does initialization in the same time with...
  20. Replies
    6
    Views
    772

    Re: Compute a factorial.

    int factorial (int n) // function that returns an int value and takes one int parameter
    {
    int fact = 1;
    for (int i=1; i<=n;i++) { // this is a for-loop, this execute the code for n times
    ...
  21. Replies
    6
    Views
    772

    Re: Compute a factorial.

    int factorial (int n)
    {
    int fact = 1;
    for (int i=1; i<=n;i++)
    fact = fact * i;
    return fact;
    }

    Here is a simple function for calculating factorial, if there is something that you don't...
  22. Thread: 64bit_int

    by Zlatomir
    Replies
    2
    Views
    4,380

    Re: 64bit_int

    Yes, it is possible, that won't be an actual build-in integer (because for example: 128bit integer you create a class that has 4 32bit int members and operate with that) but with operator overloading...
  23. Replies
    19
    Views
    4,622

    Re: Whats up with my dev c++?

    I'm pretty sure that another compiler is the "solution"

    dev c++ latest release is from 5 years ago, that's is a long period, not to mention c++0x, latest compilers (at least latest releases of gcc...
  24. Replies
    23
    Views
    2,546

    Re: Constructor Inheritance

    The commented line should be: i am passing constructor's arguments

    I'm sure that is called: "Passing constructor's arguments" (or something similar), that's not a actual function call of the...
  25. Replies
    14
    Views
    1,543

    Re: virtual method question

    If you use any virtual function do not forget to use virtual destructor.
Results 1 to 25 of 48
Page 1 of 2 1 2





Click Here to Expand Forum to Full Width

Featured