Search:

Type: Posts; User: OldGuy2

Page 1 of 7 1 2 3 4

Search: Search took 0.01 seconds.

  1. Why don't you use memset ? memset(3): fill...

    Why don't you use memset ?
    memset(3): fill memory with constant byte - Linux man page
  2. Replies
    1
    Views
    376

    Have a closer look at line 5. Do you want to...

    Have a closer look at line 5.
    Do you want to print the address of the compare function?

    There is no need for casting:


    int compare(const void* i, const void* j)
    {
    return strcmp(i, k);...
  3. Replies
    4
    Views
    503

    It's normally bad practice to use global...

    It's normally bad practice to use global variables since the can get changed from all over the code and that can make debugging very hard, it doesn't matter if they are simple vars or structs.
    It's...
  4. Replies
    24
    Views
    1,204

    What wrong results did you get, what input did...

    What wrong results did you get, what input did you use?
    Can you post the lastest code?
  5. Imagine h == 2 and b == 3. Does 6 = flaeche make...

    Imagine h == 2 and b == 3. Does 6 = flaeche make any sense?

    Doesn't your textbook tell you how to assign values to a variable ?
  6. One problem is on line 24: == is the comparison...

    One problem is on line 24: == is the comparison operator, but you should assign it to the var diagonale.
    diagonale = sqrt(pow(h,2) + pow(b,2));

    Same problem on line 31

    How did you manage to...
  7. Replies
    8
    Views
    610

    On Windows under Visual Studio you can have...

    On Windows under Visual Studio you can have structured exception handling for C.
    Be aware that your code won't work on other compilers.
    Structured Exception Handling (C/C++) | Microsoft Docs
  8. Switching to Linux is a very big step. Why don't...

    Switching to Linux is a very big step. Why don't you try clang or even Pelles IDE first ?
  9. Replies
    2
    Views
    369

    It's very easy to use the STL containers in a...

    It's very easy to use the STL containers in a poor way causing lots of allocations and deallocations and copying.
    If you show us the code we might be able to show you better ways.
  10. Replies
    11
    Views
    1,479

    Forum - C++ Forum...

    Forum - C++ Forum seems very popular
  11. Replies
    10
    Views
    1,325

    There is an overloaded version of stoi that...

    There is an overloaded version of stoi that accepst the base of the number.

    const int HEX = 16;
    stoi(num, nullptr, HEX)
    stoi - C++ Reference
  12. Replies
    6
    Views
    375

    When using uint64_t you know that it is an...

    When using uint64_t you know that it is an unsigned 64 bit type.
    What is unsigned long long int ? You can't answer it in general the size depends on the compiler and the architecturre 32/64 bit ot...
  13. Replies
    6
    Views
    375

    A few hints: unsigned long long int use...

    A few hints:

    unsigned long long int
    use uint64_t instead => include <cstdint>


    Not valid in C++
    Better use std::vector
  14. Consider using std::set_intersection. I guess...

    Consider using std::set_intersection.
    I guess you want the factors to be sorted and unique so best to store them in a std::set.
  15. It's not really clear what you want to do. Can...

    It's not really clear what you want to do.
    Can you show us the expected output with some input?
  16. A dll can have a DllMain function, not a main...

    A dll can have a DllMain function, not a main function, though it seems that it isn't necessary.
    DllMain entry point | Microsoft Docs
    PInvoke ( How to Call C from C# ) | Moy Blog
  17. Replies
    5
    Views
    339

    Easier way is iterate through the string from...

    Easier way is iterate through the string from right to left.


    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
    #include <ctype.h>
    #include <assert.h>

    /*
  18. Honestly, before writing such a game you should...

    Honestly, before writing such a game you should learn about string, struct and vector which would easily solve your problems with the variables.


    struct QuizEntry // one variable for each...
  19. What's the point of this code? By using a...

    What's the point of this code?
    By using a std::vector there would be no need to worry about copy/move semantics and memory leaks.
  20. scanf leaves '\n' in the input buffer, that's...

    scanf leaves '\n' in the input buffer, that's what getchar reads so it doesn't stop for input.
    To fix put another getchar after the last scanf.
  21. That's true, however you might get more useful...

    That's true, however you might get more useful answers if you clearly tell us what you want to do in plain English.
    It also will help you to understand the problem if you write some pseudo code in...
  22. Replies
    10
    Views
    850

    Out of curiosity: Why so complicated ? The task...

    Out of curiosity: Why so complicated ?
    The task could easily be done like this:


    #include <iostream>
    #include <string>
    #include <list>

    using namespace std;
  23. Thread: input check

    by OldGuy2
    Replies
    9
    Views
    1,279

    One way is to check the return value from scanf:...

    One way is to check the return value from scanf:


    int num;
    if (scanf("%d", &num))
    {
    puts("Valid input");
    }
    else
    {
  24. Some other ideas: 1. embed the images as...

    Some other ideas:

    1. embed the images as resources in your .exe file.

    2. deliver the images together with your .exe file

    3. store the images on the web and download them - if you can rely...
  25. People tried to figure out what he / she wants...

    People tried to figure out what he / she wants without success here:
    http://www.cplusplus.com/forum/general/235169/
Results 1 to 25 of 156
Page 1 of 7 1 2 3 4