Recent content by Peter P.

  1. P

    C/++/# C++ Collision Detection Issue

    Yes, all the sides are either vertical or horizontal. And I just thought about using the vertices to check which side collided in the shower last night as well. :) Thanks for the idea of using bits that correspond to different sides and changing them to represent which side collided with...
  2. P

    C/++/# C++ Collision Detection Issue

    My problem is not so much with programming it, but rather determining which side is collided. And for those who aren't familiar with SDL, SDL_Rect is just a structure that hold an x and y position along with a width and height ( (x,y) is the top left corner of the rectangle). So here is how...
  3. P

    C/++/# [C++] g++ compiler issues

    Ah, thanks for the help. It was the double declaration problem. I never know that you only had to specify default parameters in function prototypes and not the actual definition.
  4. P

    C/++/# [C++] g++ compiler issues

    I started using g++ and the command line on linux. In one section of my code, I provide a default argument for a function parameter. I'm just wondering why this sometimes brings up an error if i don't include -fpermissive when I'm compiling everything. As an example. This is the...
  5. P

    C/++/# C++ Vectors

    I decided to make the switch from C to C++ and I'm having trouble with vectors. In C, I prefer to use dynamically allocated arrays when doing multidimensional arrays. But in C++, I know that there is the new function which replaced malloc. I read that when dealing with multidimensional arrays in...
  6. P

    Principle of Work and Energy

    Using T for the kinetic energy is the convention used by my professor and i agree that it was odd when i first saw it as well. Second, i completely forgot about the tension, which only confuses me ever so more in how i need to incorporate it into the equation. Im thinking it depends on mB.
  7. P

    Principle of Work and Energy: Spring and Mass

    Homework Statement When the 65-kg cylinder is released from rest, the spring is subjected to a tension of 75. Determine the speed of the cylinder after it has fallen 300. How far has it fallen when it momentarily stops? Given Diagram: Homework Equations The Attempt at a...
  8. P

    Principle of Work and Energy

    Homework Statement Determine the velocity of the 60- block A if the two blocks are released from rest and the 40- block B moves 0.6 up the in cline. The coefficient of kinetic friction between both blocks and the inclined planes is = 0.05. Here is the given diagram: The Attempt at a...
  9. P

    C: 2D arrays with structs and pointers

    Yes, it's working. Thanks for the help.
  10. P

    C: 2D arrays with structs and pointers

    So, if I get what you are saying, would I change this: charLoc [i] = (int *) malloc (NUM_COLS * sizeof (CharPointers)); to this: charLoc [i] = (int *) malloc (NUM_COLS * sizeof (CharPointers *)); and if the above is correct, do you know what I would need to change to make this...
  11. P

    C: 2D arrays with structs and pointers

    But how would i use that in this context? I know that i can do that for when I'm going from pointers to structs, but what would I do for the from an int array to a pointer part?
  12. P

    C: 2D arrays with structs and pointers

    I wanted to make a variant on having a player just walking around a small 2d map. Instead of having 2 variables to store the current x and y values of the player position in a certain array, I want to make a 2d array that is filled with NULL pointers. Then the player would be represented as a...
  13. P

    C - getting input

    Thanks for the reply. Also, i was looking through the non-standard libraries that the compiler i use has, and noticed conio.h, i was wondering whether it would be better to just stick with conio or use curses? and if anyone would suggest curses, can you possibly tell me how to set it up? i use...
  14. P

    C - getting input

    im looking for functions that do not require the user to press enter. such as, they press "a" and the program continues, instead of something like "a[enter]" when using scanf.
  15. P

    For Loop Conditions in C

    i know that it is possible to have multiple conditions in a for loop. but is it seperated by a comma or would it be seperated by && like in an if statement? Thanks
Top