Search:

Type: Posts; User: rmatze

Page 1 of 5 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    12
    Views
    1,176

    Do something like this to open a file. ...

    Do something like this to open a file.




    FILE *ptr_file;

    ptr_file = fopen("output.txt", "r"); //open file to read
    if (!ptr_file)
    {
  2. I'm not familiar with that compiler. I...

    I'm not familiar with that compiler.

    I compiled this on VS and it works OK, see if it works for you.


    void print(char *foo, char *bar)
    {
    printf("%s %s\n", foo, bar);
    }
  3. Change your printLCD to void printLCD(char*...

    Change your printLCD to


    void printLCD(char* s_line1, char* s_line2)

    and it should work fine.
  4. You need to increment begin, right now it's...

    You need to increment begin, right now it's always 0.
  5. Thread: Tic Tac Toe

    by rmatze
    Replies
    88
    Views
    8,711

    Test it and find out.

    Test it and find out.
  6. Thread: Tic Tac Toe

    by rmatze
    Replies
    88
    Views
    8,711

    Then you are going to have to print each spot in...

    Then you are going to have to print each spot in the correct order, it's not that bad. Since you can't use an array you are going to need a variable for each spot (9 total). I would probably use...
  7. Thread: Tic Tac Toe

    by rmatze
    Replies
    88
    Views
    8,711

    Instead of this: int topRow, midRow,...

    Instead of this:




    int topRow, midRow, bottomRow;
    int lCol, midCol, rCol;
    int lDiag, rDiag;

    do this
  8. Replies
    16
    Views
    1,302

    Try checking the value of the variables before...

    Try checking the value of the variables before the line that is giving you troubles. Something like this:


    printf("MAX_CHILDREN: %d, children_served: %d, APPLES_PER_CHILD: %ld\n", MAX_CHILDREN,...
  9. Replies
    16
    Views
    1,302

    I ran this and it prints out correctly. Do you...

    I ran this and it prints out correctly. Do you have some other code in there that might giving you problems?


    #define MAX_CHILDREN 200
    #define APPLES_PER_CHILD 25

    int main(void)
    {
    long...
  10. Wow, must have really had it out for that person.

    Wow, must have really had it out for that person.
  11. That could get weird if I had split personalities...

    That could get weird if I had split personalities and one personality was helping the other code. :)
  12. Replies
    19
    Views
    2,217

    I wish...far from it. ha

    I wish...far from it. ha
  13. The OP pretty much has everything that i posted. ...

    The OP pretty much has everything that i posted. I don't want to give everything for that very reason. Also, what is wrong with what I posted...it worked with no errors for me.
  14. Replies
    19
    Views
    2,217

    We all had to learn just like you. I think you...

    We all had to learn just like you. I think you should stay away from recursion. Just use a do while loop instead of the for loop.


    do
    {
    //call your fib function and save the...
  15. Replies
    19
    Views
    2,217

    Nope, this is all you need: int fib(int...

    Nope, this is all you need:



    int fib(int fib1, int fib2)
    {
    return fib1 + fib2;
    }
  16. If you want to have a random num 1-10 do...

    If you want to have a random num 1-10 do something like this:


    ran_num = rand() % 10 + 1;

    Then change the 10 to the max num you want to use.
  17. Set ran_num = rand(); Then do something like...

    Set ran_num = rand();
    Then do something like this:



    if (ran_num % 2 == 0)
    {
    printf("%i\n", ran_num);
    eve_num++;
  18. Replies
    19
    Views
    2,217

    True, now that I've looked at it more, a simple...

    True, now that I've looked at it more, a simple do while loop will work just fine.
  19. Replies
    19
    Views
    2,217

    You are making this more difficult then it has to...

    You are making this more difficult then it has to be.

    You are going to want to start with fib1 = 0 and fib2 = 1. Then create a loop. Call the fib function which all you want it to do is add two...
  20. Replies
    19
    Views
    2,217

    Have you learned recursion? It would make this...

    Have you learned recursion? It would make this program a lot easier and cleaner.
  21. Replies
    2
    Views
    1,990

    Get rid of the quotes around the file name...

    Get rid of the quotes around the file name variable every time you try to open a file. It is trying to open file rFileName not what's stored in that variable.


    pRead = fopen(rFileName, "r");
  22. Do you have to save the numbers into the array. ...

    Do you have to save the numbers into the array. Just expand your for loop the go around your if statements and every time you use arr[] replace it with ran_num.
  23. Replies
    7
    Views
    1,040

    When passing a multidimensional array in this...

    When passing a multidimensional array in this manner, only the first dimension can be omitted.

    Try:



    void initial_board (char board[][BOARD_SIZE], int board_size)

    Also you don't have to...
  24. Replies
    8
    Views
    5,029

    Repost your updated code.

    Repost your updated code.
  25. Replies
    8
    Views
    5,029

    Also, you need to call the functions from main. ...

    Also, you need to call the functions from main. They can't execute if you don't call them.

    And increment i in your while loop
Results 1 to 25 of 103
Page 1 of 5 1 2 3 4