Search:

Type: Posts; User: Bench82

Page 1 of 13 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    9
    Views
    1,030

    ah, it seems to be nothing at all related to the...

    ah, it seems to be nothing at all related to the preprocessor, it seems to be related to initialising data types with a qualifier inside a function's argument list

    void foo(const unsigned long&,...
  2. Replies
    9
    Views
    1,030

    I honestly can't explain what's going on with the...

    I honestly can't explain what's going on with the preprocessor there, but it seems that the problem also occurs on comeau tryitout too. However, I wonder if this would be suitable as a workaround
    ...
  3. Replies
    2
    Views
    3,551

    Since you're using C++, you could use a string ...

    Since you're using C++, you could use a string


    #include <iostream>
    #include <string>

    int main()
    {
    std::string str = PathFindExtension("C:\\filetxt");
    if( str == "" )
  4. Replies
    4
    Views
    1,260

    If this is for statically allocated arrays then...

    If this is for statically allocated arrays then you could improve on your foo constructor somewhat by removing the need to pass a size parameter, and have the compiler automatically detect it (Also...
  5. Replies
    6
    Views
    3,154

    No, look carefully - the Numbervector is a...

    No, look carefully - the Numbervector is a reference argument not a copy - a reference is just an alias for another object in memory. pass-by-reference is often used for referring objects which...
  6. Replies
    6
    Views
    3,154

    Is there any reason for using a pointer over a...

    Is there any reason for using a pointer over a reference? Doing so might make your program a little cleaner
    InitializeVector(vector<int>& pNumber)
    {
    vector<int> temp;
    //Do stuff with...
  7. I think we need to wait til C++0x in order to...

    I think we need to wait til C++0x in order to really simplify that ugly function signature
    template<typename T, int N>
    typedef T (&array_t)[N]; ** I assume that this will eventually be legal,...
  8. You could do this instead. #include ...

    You could do this instead.
    #include <iostream>
    using namespace std;

    template<typename T, int N>
    char (&array(T (&)[N]))[N];

    int main()
    {
    int numA[]={0,1,2,3,4};
  9. Replies
    19
    Views
    2,249

    Forward declarations for classes are insufficient...

    Forward declarations for classes are insufficient for creating instances for the simple reason that forward declarations only provide a hint that the class exists somewhere. In order for a class to...
  10. Replies
    24
    Views
    8,669

    Visual Basic 6.0 won't help you much in writing...

    Visual Basic 6.0 won't help you much in writing C++ code. Even if you were using Visual C++ 6.0, its out of date, and doesn't support the latest standard (So features that should be available are...
  11. Replies
    6
    Views
    2,201

    Actually, maybe a little too random :) -...

    Actually, maybe a little too random :) - extreme' values would be more common, and the 'middle-road' values would occur less frequendly.. The distribution should be uneven (in theory) so that...
  12. Replies
    6
    Views
    2,201

    For convenience, I would put the dice roll in a...

    For convenience, I would put the dice roll in a function

    int roll( int sides, int num_dice )
    {
    int sum = 0;
    for( int i = 0; i < num_dice; ++i)
    sum += rand() &#37; sides + 1;

    ...
  13. Replies
    23
    Views
    2,218

    Several people in fact.. most notably, Bjarne...

    Several people in fact.. most notably, Bjarne Stroustrup said this about (void) between function parenthesis.
    http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.4
  14. You can't have a reference to a literal value,...

    You can't have a reference to a literal value, therefore having a default argument for a reference doesn't make much sense.

    One thing you could do (I don't reccomend doing this because it involves...
  15. Replies
    5
    Views
    1,475

    My interpretation of formal parameters/actual...

    My interpretation of formal parameters/actual parameters was between function prototypes and function definitions. ie,


    void foo(int blah); // 'blah' is a formal parameter

    int main()
    {
    ...
  16. I can't think of any off the top of my head -...

    I can't think of any off the top of my head - Prelude's website should get you started though. The Binary Search Tree is the most primitive type of binary tree, other trees all attempt to fix the...
  17. Who said that either method has any 'advantage'...

    Who said that either method has any 'advantage' over the other?

    perhaps you could explain what you are attempting to do, and why you think one way may or may not be better
  18. Replies
    7
    Views
    2,170

    Cornedbee pointed out one mistake, but you seem...

    Cornedbee pointed out one mistake, but you seem to be confused on rather alot more.
    Be specific, else you end up being misleading. The result of losing a bit to the sign causes the maximum...
  19. Replies
    7
    Views
    5,689

    Re: Stroustrup 3rd Edition.. Why not pick the...

    Re: Stroustrup 3rd Edition..

    Why not pick the Special Edition instead..? (Which I believe was updated since the 3rd edition, and has a nice hardback cover)
  20. Thread: Money problem

    by Bench82
    Replies
    6
    Views
    2,220

    Of course it is - because that's how long it...

    Of course it is - because that's how long it takes for an interest rate of 5&#37; to at least double your money. it doesn't matter how much money you start with, whether its &#163;1 or &#163;1 billion..
    ...
  21. Replies
    8
    Views
    1,926

    Only if the class is to be used polymorphically...

    Only if the class is to be used polymorphically and delete'd via a base-class pointer (And then its an issue of undefined behaviour, rather than a memory leak)

    I don't know about "forgets" -...
  22. Replies
    2
    Views
    1,094

    use the getline function. eg, #include...

    use the getline function. eg,
    #include <iostream>
    #include <string>

    using namespace std;

    int main()
    {
    string full_name;
    cout << "Enter your full name: ";
  23. Replies
    23
    Views
    3,394

    The problem is somewhere else then. Could you...

    The problem is somewhere else then. Could you paste the entire block of code that gave you the error?
  24. Replies
    5
    Views
    2,640

    Polymorphism lets you design a single interface...

    Polymorphism lets you design a single interface (from a programming perspective, not a user interface) which is used to access different types of objects.

    The advantage is being able to generalise...
  25. Replies
    23
    Views
    3,394

    In that case your laptop has an American...

    In that case your laptop has an American keyboard, but windows is treating it like a UK one.
Results 1 to 25 of 322
Page 1 of 13 1 2 3 4