Search:

Type: Posts; User: Matticus

Page 1 of 20 1 2 3 4

Search: Search took 0.08 seconds.

  1. Replies
    2
    Views
    1,785

    Dealing With Objects as Members of a Class

    I'm working my way through a C++ book (again), and am up to a section on composition.

    The book (Deitel) strongly recommends keeping such objects private: "[making member objects public] does...
  2. Thread: OOP Advice

    by Matticus
    Replies
    2
    Views
    6,044

    I like this approach a lot. Getting the range of...

    I like this approach a lot. Getting the range of acceptable values would then simply be a matter of grabbing a subsection of the pre-computed data.

    I will probably use a Compute() method instead...
  3. Replies
    8
    Views
    1,576

    I'd recommend starting right at the source:...

    I'd recommend starting right at the source: Simple DirectMedia Layer - Homepage
    There is a lot of information in their wiki to get started.

    I'd also suggest you start getting used to separating...
  4. Thread: OOP Advice

    by Matticus
    Replies
    2
    Views
    6,044

    OOP Advice

    I'm posting this here since I'm currently learning C#, but this is more of an OOP question.

    The program I'm writing will calculate the parallel resistance of two resistors. The user enters a...
  5. Thread: Hello again!

    by Matticus
    Replies
    1
    Views
    2,094

    Hello again!

    Hey all, it's been a long time.
    How is everyone doing?
  6. Replies
    3
    Views
    10,387

    break is intended to break out of a loop or...

    break is intended to break out of a loop or switch case. Did you mean to use while instead of if on line 7?
  7. Replies
    4
    Views
    3,227

    If your code still isn't working, you need to...

    If your code still isn't working, you need to post the latest version. We don't know which bit of the [good] advice you chose to apply, and whether you've applied it correctly.

    To make it easier...
  8. You're reading and writing in binary, not text. ...

    You're reading and writing in binary, not text. In this context, '\0' does not behave as a string-terminating character. Hence it is printing the actual binary value of '\0'.

    Incidentally, when...
  9. Replies
    7
    Views
    6,919

    Read post #2 again, and do a little bit of...

    Read post #2 again, and do a little bit of research.
  10. Replies
    7
    Views
    6,919

    Your code? What you've posted is extremely...

    Your code? What you've posted is extremely similar to the code here: c - Client connects to server randomly - Stack Overflow

    Furthermore, you've provided no answers to the questions I asked. ...
  11. Replies
    7
    Views
    6,919

    If you're completely new to C, I would recommend...

    If you're completely new to C, I would recommend starting with the basics, and tackling network and thread programming later on.

    What type of sockets are you using?
    Does your program use the...
  12. Start with a simple practice program to test...

    Start with a simple practice program to test passing a struct pointer to a function and traversing the list. Something like this:



    #include <stdio.h>
    #include <stdlib.h>

    struct stest
    {
    ...
  13. Yes, just keep track of the largest value while...

    Yes, just keep track of the largest value while looping through the structs. If a larger magnitude is found, save this value (for subsequent comparisons) along with the corresponding value of N.
  14. You asked this question on your other thread,...

    You asked this question on your other thread, let's keep it there -> keep getting an to me unknown error
  15. Replies
    3
    Views
    1,696

    It would be easier to help you if the prompts...

    It would be easier to help you if the prompts were translated to English. Also, you should provide the inputs that cause the problems you're seeing (what input are you giving it, what output do you...
  16. If you want to access all allocated structs, have...

    If you want to access all allocated structs, have your function receive a pointer to struct. Then you can move through the structs as if it were an array.

    A shorthand way of accessing an element...
  17. Replies
    3
    Views
    1,696

    You need to pass the address of the variable to...

    You need to pass the address of the variable to scanf.
  18. Replies
    18
    Views
    6,489

    You may want to run your code through a debugger...

    You may want to run your code through a debugger to find the problem. You are likely accessing memory you aren't allowed to.

    You should not cast malloc, and you should check the return value of...
  19. Replies
    4
    Views
    1,520

    You need to declare the functions in the header...

    You need to declare the functions in the header file, like so:



    #ifndef RATIONAL_H
    #define RATIONAL_H

    typedef struct {
    long numerator, denumerator;
    }rational;
  20. Replies
    5
    Views
    12,876

    There's an explanation and simple fix for that...

    There's an explanation and simple fix for that here: FAQ > How do I avoid a "dangling" newline when reading single character user input? - Cprogramming.com
  21. Replies
    2
    Views
    3,426

    There could be several reasons for this issue. ...

    There could be several reasons for this issue. Post a complete (preferably simplified) version of the program that exhibits the problem.



    To compare strings in C, you should be using strcmp.
  22. Replies
    5
    Views
    3,661

    I second john.c's suggestion. You might consider...

    I second john.c's suggestion. You might consider reading up on the BMP file format and creating your own small library to manipulate the images however you'd like.
  23. You're still trying to use the length of the...

    You're still trying to use the length of the string to determine whether to clear the input buffer, which will not work.

    Check for the presence of the newline to determine if the entire input has...
  24. Replies
    10
    Views
    10,087

    That can be argued, yes, but in many cases you...

    That can be argued, yes, but in many cases you can avoid using goto by carefully planning and restructuring your logic to avoid heavily nested loops.
  25. Replies
    10
    Views
    10,087

    Yes, or any other input command. Then...

    Yes, or any other input command.



    Then that's the size you need to pass to fgets. As it stands, you're giving it sizeof(userInput) which is 64.
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4