Search:

Type: Posts; User: BMJ

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    3
    Views
    745

    edit: on second thought I probably misread your...

    edit: on second thought I probably misread your question but I'll share this anyway


    #include <iostream>
    #include <sstream>
    #include <string>

    int main()
    {
    std::string num("100");
  2. Replies
    10
    Views
    5,654

    If we're talking about C++0x you could take...

    If we're talking about C++0x you could take Ronix's example a step further and use a lambda for the predicate parameter to sort:

    template<typename T>
    void mfunc()
    {
    ...
  3. Replies
    8
    Views
    1,411

    By having a public method return a TestStruct you...

    By having a public method return a TestStruct you effectively negate the privateness of it. If you want TestStruct to be private then you shouldn't return any TestStruct through public methods.
    ...
  4. Replies
    10
    Views
    1,809

    Maybe this is less confusing; It does the same...

    Maybe this is less confusing; It does the same thing:

    #include <iostream>
    #include <limits>
    using namespace std;

    int main()
    {
    int a;
  5. I can help you conceptually, but without any code...

    I can help you conceptually, but without any code of your own I don't feel very motivated to write any myself.

    Conceptually: read from some input one character at a time, testing whether it's...
  6. Replies
    10
    Views
    1,809

    The extraction ">>" and inserter "

    The extraction ">>" and inserter "<<" operators both return references to their respective stream objects, meaning that the expression "cin >> a" evaluates into a reference to "cin"

    It's done this...
  7. Replies
    10
    Views
    1,809

    #include #include using...

    #include <iostream>
    #include <limits>
    using namespace std;



    int main()
    {
    int a;
    cout << "Enter number\n";
  8. Thread: Floats

    by BMJ
    Replies
    7
    Views
    1,032

    Have you considered using a fixed-point...

    Have you considered using a fixed-point representation?
  9. Replies
    10
    Views
    862

    Put loops inside your loops to make them faster:...

    Put loops inside your loops to make them faster:

    while (true)
    {
    while (true)
    {
    while (true)
    {
    // uber-fast!
    }
  10. Replies
    3
    Views
    4,586

    You could do that with the conditionals but the...

    You could do that with the conditionals but the compiler will recognize the common expressions and generate code mostly equivalent to what you have already.

    Or do you want to directly modify the...
  11. Thread: generated assembly

    by BMJ
    Replies
    3
    Views
    1,322

    With WPO turned off your main module has no...

    With WPO turned off your main module has no knowledge of the Bla module and so the optimizer can't do certain things like find the best use of registers across module boundaries.

    Since you're...
  12. Replies
    5
    Views
    4,958

    MSVC already conforms to the ISO standard for...

    MSVC already conforms to the ISO standard for C++, however, like most C++ compilers there are non-standard extensions available for use, I doubt it would be a problem for most newcomers, however if...
  13. it's already been said but use stringstreams: ...

    it's already been said but use stringstreams:


    #include <iostream>
    #include <string>
    #include <sstream>
    using namespace std;


    int main()
  14. Thread: arrays

    by BMJ
    Replies
    7
    Views
    1,060

    Are you sure that's MFC and not C++/CLI? :)

    Are you sure that's MFC and not C++/CLI? :)
  15. Thread: Printing Double?

    by BMJ
    Replies
    7
    Views
    1,613

    cout.precision(1); cout

    cout.precision(1);
    cout << fixed << a << endl;

    e: I'm not quite fast enough
  16. Yeah, somewhat confusing. If you don't specify...

    Yeah, somewhat confusing.

    If you don't specify a "break" after some case block then program flow continues linearly, hence it "falls through" to the subsequent cases.

    Perhaps the C language...
  17. Replies
    9
    Views
    932

    I don't think O(n^2) is right. Most (actually...

    I don't think O(n^2) is right. Most (actually all, IIRC) implementations of unordered_map use hash tables and any sane hash table is going to have linear worst-case performance.

    I don't like the...
  18. Memory which is allocated on the stack or the...

    Memory which is allocated on the stack or the heap can be thought of as dynamic because its allocation depends on the flow of program control.

    Memory which is allocated once when the program is...
  19. Are you expected to turn in program source code...

    Are you expected to turn in program source code or compiled executables? If you only need to turn in the source code then simply write portable (i.e. conforming strictly to the language standard and...
  20. Replies
    14
    Views
    1,017

    Ah, thank you! That's exactly what I was looking...

    Ah, thank you! That's exactly what I was looking for.
  21. Replies
    14
    Views
    1,017

    But it's not an initialization, it's an...

    But it's not an initialization, it's an assignment?

    I've been trying to find proof that this is legal in C++0x but I haven't had any success. Care to point me in the right direction?

    Thanks.
  22. Replies
    18
    Views
    29,406

    Readability and debugability (is that even a...

    Readability and debugability (is that even a word?) are rather subjective but some people (including me) find the switch statement to be more clear. However, in many cases a compiler has a better...
  23. Thread: Borland is a JOKE

    by BMJ
    Replies
    11
    Views
    1,495

    Microsoft Express Downloads - Visual Studio...

    Microsoft Express Downloads - Visual Studio Express and SQL Server Express
    Microsoft's C/C++ compiler is free to use, it's also a very good compiler.

    Development for Beginners | C++ Beginner's...
  24. Replies
    7
    Views
    3,863

    Since you're dealing with a ball bouncing inside...

    Since you're dealing with a ball bouncing inside of a square you don't need to worry about complex calculations involving angles of incidence and reflection, it's very straightforward in this...
  25. Replies
    7
    Views
    3,863

    So what are you more curious about: how to draw...

    So what are you more curious about: how to draw the ball, how to make it bounce randomly off of walls, or how to use MFC in general?
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4