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

Search:

Type: Posts; User: laserlight

Page 1 of 80 1 2 3 4

Search: Search took 0.14 seconds.

  1. Re: Programme tracage de deux fonctions problem ---- expected')'before'double'------

    It looks like you should define fonction as a function rather than a function-style macro.

    Also, your code is badly in need of proper formatting, e.g., blank lines to separate logical sections in...
  2. Replies
    10
    Views
    212

    Re: Global variables little help pls

    Declare it before the main function definition, then call it as per normal, e.g.,

    void f();

    int main()
    {
    f();
    }
    In a larger program, this declaration of f would go into a header fine.
  3. Replies
    10
    Views
    212

    Re: Global variables little help pls

    No, call the function in the main function, not define it in the main function. Furthermore, you need to call it at the right place.
  4. Replies
    10
    Views
    212

    Re: Global variables little help pls

    You did not call the find_e function (which you named f) in the main function.
  5. Replies
    10
    Views
    212

    Re: Global variables little help pls

    Just checking: did you teacher stress to you that global variables should be avoided?


    Please post your well formatted code in
    bbcode tags. Does this program work correctly?
  6. Replies
    24
    Views
    1,773

    Re: Problem with maps

    Create a second map or use boost::bimap.
  7. Replies
    24
    Views
    1,773

    Re: Problem with maps

    You have to do linear search, i.e., loop over the mapped values one by one and compare. I believe that std::find_if can be used (i.e., you need to provide a comparator that will compare the mapped...
  8. Replies
    24
    Views
    1,773

    Re: Problem with maps

    It compiles for me. I only received this warning:

    test.cpp: In function ‘int main()’:
    test.cpp:20:10: warning: unused variable ‘lettr’ [-Wunused-variable]
    char lettr = 'e';
    But this is not...
  9. Replies
    5
    Views
    663

    Re: What is wrong with my code?

    Perhaps you wanted to declare one of the two operator[] overloads to be a const member function?
  10. Replies
    6
    Views
    867

    Re: How to use Perceptualdiff

    It seems to me that Perceptualdiff is a tool that is unrelated to C++ in general, so it is unreasonable to suppose that the users who frequent this forum will be familiar with it such that we can...
  11. Re: What could cause a core dump at iterator pre increment??

    That would be a problem, yes. But mindlessly treating "all iterators for that container are invalid after an erase" as invalid is not a best practice to defend against such a 'bright' programmer....
  12. Re: What could cause a core dump at iterator pre increment??

    Not for std::map. As 2kaud implied, erase for std::map was changed in C++11 to return an iterator instead of void.


    You probably saw an example for std::vector. (EDIT: oh, std::list would be more...
  13. Re: What could cause a core dump at iterator pre increment??

    No, it depends on the container. It is best to check what iterators (and references and pointers) will be invalidated rather than just assume that all of them will be. In the case of std::map only...
  14. Replies
    26
    Views
    1,487

    Re: Problems with operator overloading

    There is no need to do that. The class template from the standard library is named complex, not Complex, so there is no name collision to begin with. Even if there was a name collision, it would be...
  15. Replies
    26
    Views
    1,487

    Re: Problems with operator overloading

    operator<< should be declared to be a non-member function with two parameters:

    std::ostream& operator<< (std::ostream &stream, const Complex &nr);
    Since it has access to the private member...
  16. Replies
    1
    Views
    808

    Re: Reading from stdin

    When you read into n using formatted input with operator>> the newline from entering the input remained in the input buffer. This newline was then read by getline, resulting in str being an empty...
  17. Replies
    24
    Views
    1,773

    Re: Problem with maps

    What was the error message?
  18. Re: Ordering 1000 numbers in one single line, all separated by a comma

    You could do this with a spreadsheet program: insert the contents as two columns, delete the first column, tranpose to rows, then export as CSV.

    If you would rather write a program/script, then...
  19. Replies
    24
    Views
    1,773

    Re: Problem with maps

    In what way was it strange?

    Besides, it might be strange to you, but someone else here who has seen it or otherwise understands it might not find it strange.
  20. Replies
    6
    Views
    266

    Re: Private base classes

    C++11 refers to the 2011 edition of the C++ standard, which is the document, published in 2011, that defines the standard version of C++ (at least until the next edition is published, most probably...
  21. Replies
    6
    Views
    266

    Re: Private base classes

    Yes. You can refer to the phrasing in the standard:
  22. Replies
    6
    Views
    266

    Re: Private base classes

    "If a base of class D is private, its public and protected member names can be used only by the members of D."

    What this means is that if you have a class like this:

    #include <iostream>
    ...
  23. Replies
    8
    Views
    622

    Re: Help with cin.get() function

    What material are you using to learn C++? It should cover this at some point.
  24. Replies
    3
    Views
    446

    Re: std::vector question

    Ah, emplace_back was introduced in C++11. The idea is to directly construct at the back of the vector an element with the given arguments supplied to the relevant constructor, without involving any...
  25. Replies
    3
    Views
    446

    Re: std::vector question

    Since C++11, there are two versions of push_back, one with a const lvalue reference parameter, the other with an rvalue reference parameter. Both only take one argument though, so your #1 looks...
Results 1 to 25 of 2000
Page 1 of 80 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center