Search:

Type: Posts; User: JacobN

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Thread: for loop!

    by JacobN
    Replies
    3
    Views
    1,063

    If I understand your somewhat vague question...

    If I understand your somewhat vague question correctly, you wish you have the output like so:


    NUMBER SQUARE CUBE
    ====== ====== ====
    1 1 1
    2 4 ...
  2. "" is an escape character, that is, a character...

    "\" is an escape character, that is, a character which results in an alternative interpretation of the following character(s). For more information, simply look up "Escape character" on Google.
  3. You need to escape the "" with another "", so...

    You need to escape the "\" with another "\", so when you wish to output a single "\", you have to output "\\".
  4. Thread: Polymorphism

    by JacobN
    Replies
    4
    Views
    1,409

    Well, you could make the Thing class hold a...

    Well, you could make the Thing class hold a vector of pointers to Shapes, like this:


    class Thing {
    public:
    /* Constructors and public member functions */
    void Draw();
    private:
    /* Other...
  5. Thread: Polymorphism

    by JacobN
    Replies
    4
    Views
    1,409

    I'm sure someone else will be better at...

    I'm sure someone else will be better at explaining your first few questions, because I'm generally bad at explaining things. But I can however provide a suggestion for your last question:

    Wouldn't...
  6. Thread: c++

    by JacobN
    Replies
    1
    Views
    842

    With proper indentation the first error is easy...

    With proper indentation the first error is easy to identify:


    #include<iostream>
    #include<string>

    using namespace std;

    int main() {
    char strn[10];
  7. Replies
    16
    Views
    1,956

    Indeed the "Classic" version does. And I know...

    Indeed the "Classic" version does.

    And I know it's kind of unusual to overload those operators, I can't even think of a case where it would make sense either, but that doesn't keep people from...
  8. Replies
    16
    Views
    1,956

    It should also be noted that if you overload the...

    It should also be noted that if you overload the && or || operator(s) for a type (or they are overloaded for a type provided by a library, for example) these will not short circuit, and so both the...
  9. Replies
    1
    Views
    4,800

    Are you sure you really have to calculate the...

    Are you sure you really have to calculate the coefficients inside your code? It isn't good enough to just determine them with another tool made for the job, and then just hard code them/load them...
  10. Replies
    6
    Views
    1,959

    Not really sure he needs to use mmap or anything....

    Not really sure he needs to use mmap or anything. On my not-so-fast laptop, I can load in a 2 MB file in less than 1 second, and in that time frame also count the number CG parts. I first get the...
  11. Thread: SDL movement

    by JacobN
    Replies
    5
    Views
    1,799

    I think that's because you're polling the event...

    I think that's because you're polling the event from the event queue in the global function handle_events function, then you poll it again in character::handle_event. This means it has to wait till...
  12. Replies
    1
    Views
    2,121

    I believe it does so through ADL...

    I believe it does so through ADL
  13. Thread: Syntax question

    by JacobN
    Replies
    1
    Views
    886

    The colon indicates the start of the...

    The colon indicates the start of the initialization list, and the empty curly brackets simply indicate an empty function body.
  14. Replies
    5
    Views
    2,759

    Are you sure the image you're trying to load is...

    Are you sure the image you're trying to load is in the same folder as the program expects it to be? Additionally, to actually get the image to show after you blit it to the 'buffer' surface, remember...
  15. This function, you have i as unsigned, when you...

    This function, you have i as unsigned, when you reach zero, then decrement it, you're not going to be below zero as you seem to expect(Assuming unsigned int is 32 bit, you end up with the value...
  16. Replies
    3
    Views
    9,474

    The code you provide doesn't compile, there are...

    The code you provide doesn't compile, there are several errors:

    1: Main should probably return int unless you're running on some older embedded platform.
    2: The way you're "iterating" over the...
  17. Replies
    2
    Views
    1,423

    You compile the code you have into an executable...

    You compile the code you have into an executable and then create a process using CreateProcess, where the lpApplicationName is set to the name of the executable you created.

    In case you wish to...
  18. The while-loop relies on the state of the "input"...

    The while-loop relies on the state of the "input" ifstream object, if it has reached the end of the file(or if there somehow was an error while reading i suppose) it will break out of the loop.
  19. Replies
    2
    Views
    1,275

    void sortem(whole p[]) { int i,j; for...

    void sortem(whole p[])
    {
    int i,j;
    for (j=0;j<maxp-1;i++)
    for (i=0;i<maxp-1;i++) if (p[i].department > p[i+1].department) swapem(p[i],p[i+1]);
    }
    Are you really sure you mean that? Also,...
  20. Alright, I have something like this: #include...

    Alright, I have something like this:

    #include <iostream>
    #include <limits>
    #include <fstream>

    int main( void )
    {
    std::ifstream input( "input.txt" );
  21. If you think that's what the code is doing, why...

    If you think that's what the code is doing, why do you keep all the old values in an array in memory? And yes I can think of a way of doing this, it's more or less the same as yours, just without the...
  22. I think the question you should be asking...

    I think the question you should be asking yourself is:

    If I just have to find the largest and the smallest value, do I have to store all the values in memory?
  23. Replies
    14
    Views
    4,041

    I don't see why not? If you just make sure that...

    I don't see why not? If you just make sure that if you pass this map of sets to functions by reference instead of value there shouldn't be a problem? As for whether it's the most efficient way to...
  24. Thread: memory error

    by JacobN
    Replies
    18
    Views
    3,453

    Because you're throwing an exception...? Maybe...

    Because you're throwing an exception...? Maybe you should try reading up on exceptions and exception handling before continuing?
  25. Replies
    12
    Views
    6,212

    According to this thread: Cocoabuilder -...

    According to this thread:

    Cocoabuilder - (Dmitry Markman) ostringstream problem with Xcode 3.2

    Assuming you're using Xcode, try setting it to build as Release rather than Debug?
Results 1 to 25 of 47
Page 1 of 2 1 2