Search:

Type: Posts; User: -Adrian

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    5
    Views
    160

    if (num2 == 0) { // not '0' However, comparing...

    if (num2 == 0) { // not '0'

    However, comparing a float to 0 isn't quite as simple as that either, so I would recommend you declare num2 as an integer (num1 can stay float). It's complicated ;)
  2. Replies
    5
    Views
    160

    You could try that yourself as an exercise! Place...

    You could try that yourself as an exercise! Place an extra check inside the else-if section for division. If the user tries to divide by 0, you could then print a message and go to the next iteration...
  3. Replies
    7
    Views
    188

    exercise2.cpp:17:19: error: C++ requires a type...

    exercise2.cpp:17:19: error: C++ requires a type specifier for all declarations
    void read_ages(&name, n) // member function
    ^
    exercise2.cpp:17:25: error: unknown type name 'n'
    ...
  4. Replies
    7
    Views
    188

    Do you come from another programming language?...

    Do you come from another programming language? You should have learned about function calls and scopes before touching the class construct. Go back to the section about functions and how to define...
  5. Replies
    5
    Views
    160

    Without having put much thought into this, here...

    Without having put much thought into this, here is a quick solution:


    if (op == 'x')
    {
    cout << "Are you sure you would like to exit?" << endl;
    cout << "Enter y to exit" << endl;
    ...
  6. Replies
    2
    Views
    134

    int main (void) { int a = 5; // 'a' starts...

    int main (void)
    {
    int a = 5; // 'a' starts existing here
    printf ( "\n a : %d", a);

    function(); // 'b' starts existing and stops existing here

    return 0; // 'a'...
  7. You should post this in the C++ forum, as this...

    You should post this in the C++ forum, as this isn't C.

    What the error message do you get? Also, you're missing a template declaration on line #20, in case that wasn't just lost in the copy/paste.
  8. // 4 byte object, 8 byte (64bit) address char...

    // 4 byte object, 8 byte (64bit) address
    char x[4];
    sizeof(x) -> gives 4
    sizeof(&x) -> gives 8

    // 16 byte object, 8 byte address
    struct sockaddr_in sa;
    sizeof(sa) -> gives 16...
  9. Replies
    13
    Views
    240

    Yes, I haven't tried XCode myself but it looks...

    Yes, I haven't tried XCode myself but it looks good on the surface and I suspect the Clang/LLDB integration is nice for writing C.
  10. Replies
    13
    Views
    240

    CodeBlocks for Mac appears to not be maintained....

    CodeBlocks for Mac appears to not be maintained. Have you considered XCode¹?

    ¹ Personally I'm against beginners using these unwieldy IDEs, because they have so many knobs and dials yet obscure the...
  11. Show us the code you have tried already, for...

    Show us the code you have tried already, for instance, you probably went with a loop of some kind.
  12. #include int foo (int q) // this...

    #include <stdio.h>

    int foo (int q) // this function is run when you call it, not wherever you write it down
    {
    int y = 1;
    printf("q=%i\n", q);
    return (q + y); // if q=5, this will...
  13. Thread: Slow forum?

    by -Adrian
    Replies
    11
    Views
    552

    @webmaster Did you check your logs for origin of...

    @webmaster Did you check your logs for origin of traffic? If the board was hammered by small number of IPs, then setting up something like fail2ban would be safer bet for the future, assuming this...
  14. Replies
    13
    Views
    272

    Oh, you're using templates! Sorry, totally missed...

    Oh, you're using templates! Sorry, totally missed that. As laserlight said, move the implementation into the header.
  15. Replies
    13
    Views
    272

    Have you added utilities.cpp to your project as a...

    Have you added utilities.cpp to your project as a dependency, so that it gets linked? (I don't know how VS works)
  16. Replies
    13
    Views
    272

    Put it as close to your use as is sensible, e.g....

    Put it as close to your use as is sensible, e.g.


    int main()
    {
    rngT rng;
    const auto result = Roll_DX_Ntimes(rng, 1, 2);
    }

    Avoid global variables except for edge cases (which are...
  17. Replies
    13
    Views
    272

    You're initializing an object in the header. That...

    You're initializing an object in the header. That is the problem, not the typedef.
  18. Replies
    13
    Views
    272

    And post your code if you still run into issues.

    And post your code if you still run into issues.
  19. Thread: Slow forum?

    by -Adrian
    Replies
    11
    Views
    552

    I feel the same. Does the admin need help? I'm...

    I feel the same. Does the admin need help? I'm going to assume that whoever is sending all these queries isn't so sophisticated that static or dynamic block rules couldn't be put into place. I don't...
  20. I'm not sure what exactly your question is, but...

    I'm not sure what exactly your question is, but the errors point to:


    Your glibc being too old
    Apache needing to be compiled with mod_so module support


    So naturally, you'd want to upgrade...
  21. Replies
    14
    Views
    350

    He just told you, and you already have the code....

    He just told you, and you already have the code. So what's the hold up? If you didn't write this code and didn't pay attention in class, then we're not going to do your homework.
  22. You can capture (by value) the pointer to your...

    You can capture (by value) the pointer to your class object:


    bool IncorrectScale = any_of(Loadout.begin(), Loadout.end(), [this](auto& weapon) { return weapon->WeaponScale != PlayerScale; });
  23. Thread: Slow forum?

    by -Adrian
    Replies
    11
    Views
    552

    Ah so that's why, I see. I contacted the...

    Ah so that's why, I see. I contacted the webmaster and he said something about "scraping effort" but I totally misread that as something he is doing himself to free the forum/db of old cruft.
    ...
  24. Thread: Slow forum?

    by -Adrian
    Replies
    11
    Views
    552

    Slow forum?

    The forum has been slow to the point of being unusable the past week. Takes me about 5-10 seconds to get a handshake, 30-40 seconds for the page the render (if I'm lucky and the request don't just...
  25. Replies
    3
    Views
    193

    Did you pass the paths relative to your...

    Did you pass the paths relative to your CMakeLists.txt as I showed in my example? Also, what do you do to invoke CMake? Looks like one needs to create the Codeblocks project through the CLI first,...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4