Search:

Type: Posts; User: DCMann2

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    25
    Views
    2,925

    Okay, a put a printf in the nested for loop, but...

    Okay, a put a printf in the nested for loop, but instead of printing the 5x5 matrix, it just prints all 25 numbers right in a row. How do I fix this?


    #include <stdio.h>
    #include <stdlib.h>
    ...
  2. Replies
    25
    Views
    2,925

    #include #include ...

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

    #define DIM 5

    int main()
    {
    int mat[DIM][DIM] = {0}, row, col, rowSum, colSum;

    printf("Enter 25 numbers: ");
  3. Replies
    25
    Views
    2,925

    No, I'd enter them with spaces between them, like...

    No, I'd enter them with spaces between them, like 1 2 3 4 5 etc.
  4. Replies
    25
    Views
    2,925

    I wanted it to print the whole matrix, though,...

    I wanted it to print the whole matrix, though, not just a single element. I tried doing printf("&#37;d", mat[row][col]), but that didn't work...it gave me that big number I was telling you about earlier....
  5. Replies
    25
    Views
    2,925

    I know it's not what I want, but can you explain...

    I know it's not what I want, but can you explain why the matrix isn't working properly? I tried doing a printf of the matrix, but all it gives me is one big number that doesn't contain a single...
  6. Replies
    25
    Views
    2,925

    Alright, I've done some more work on this since I...

    Alright, I've done some more work on this since I last posted, but it's not working right. I'm pretty sure my rowSum and colSum functions are wrong, but at this point I'm mostly concerned about...
  7. Replies
    25
    Views
    2,925

    That's great, but I still don't know how to...

    That's great, but I still don't know how to actually allow the user to enter the values they want. How do I do that? I've read the chapter in my book about arrays a thousand times and I still can't...
  8. Replies
    25
    Views
    2,925

    Use the same code? How would I do that? If I can...

    Use the same code? How would I do that? If I can get the row adding part sorted out, I could figure out the column part without too much difficulty.

    I'm still having trouble with entering the...
  9. Replies
    25
    Views
    2,925

    I understand how the code works, but now that I...

    I understand how the code works, but now that I have that code, how do I allow the user to enter the values of the array so I can add up the rows and columns?


    #include <stdio.h>
    #include...
  10. Replies
    25
    Views
    2,925

    Is it possible to use a single dimensional array?...

    Is it possible to use a single dimensional array? It seems that it might be easier to use a one dimensional array because it's easier to add the rows that way, but would it possible to add up the...
  11. Replies
    25
    Views
    2,925

    Need help working with an array

    Hi all, I'm having trouble working with an array, and I was wondering if anyone could explain it to me. What I want to do is have a 5x5 array, entered one row at a time, that will add each row and...
  12. Replies
    12
    Views
    1,465

    I initialized maximum to 0, but it still prints...

    I initialized maximum to 0, but it still prints the maximum number as 0 because the statement


    if (current > maximum)
    current = maximum;

    Will always be true, so current is always...
  13. Replies
    12
    Views
    1,465

    As far as I could tell, it set the maximum number...

    As far as I could tell, it set the maximum number as the current number, but the trouble I'm having is figuring out how to hold that number as the max until the current number is bigger, then just...
  14. Replies
    12
    Views
    1,465

    That's just it, I'm not exactly sure how to tell...

    That's just it, I'm not exactly sure how to tell the program that the current number is the maximum until the current number is bigger than the maximum. I've changed the code a little bit, but I...
  15. Replies
    12
    Views
    1,465

    Hey guys, I'm still having a bit of trouble...

    Hey guys, I'm still having a bit of trouble getting the loop to work properly. Every time the program executes and exits the loop, it always prints the maximum as 0.00000. Can anyone explain why this...
  16. Replies
    12
    Views
    1,465

    So what you're saying is I should set up a while...

    So what you're saying is I should set up a while loop with if statements? Like, I could have two variables named num1 and num2, and in the loop have an if statement saying if num1 >= num2, num1 =...
  17. Replies
    12
    Views
    1,465

    Help with a loop

    Hi all,

    I'm having a bit of a brain fart with this loop problem, and I was wondering if I could get a little help from you guys.

    I'm supposed to write a program that finds the largest in a...
  18. Replies
    7
    Views
    3,878

    I ended up getting it to work on my own, but I'll...

    I ended up getting it to work on my own, but I'll definitely save this code here for future reference. Thanks a lot for your help! :D
  19. Replies
    7
    Views
    3,878

    Alright, I did some work to my code, but the...

    Alright, I did some work to my code, but the section where the user is supposed to enter the coordinates is still giving me problems. Here's what I have so far:


    void fillBoard(bool...
  20. Replies
    7
    Views
    3,878

    That would make that cell alive or dead, right?...

    That would make that cell alive or dead, right? The problem I'm running into now is how I can allow the user to specify which cell he or she wants alive or dead. For example, if I want cell 1,1 to be...
  21. Replies
    7
    Views
    3,878

    This is the part of the code that I'm having the...

    This is the part of the code that I'm having the most trouble with. It doesn't compile in its current form, but if someone could give me some pointers in the right direction, I can try to get it...
  22. Replies
    7
    Views
    3,878

    Help with code modification

    Hi everyone, I need some help with some code modification for a game. It's based off of John Conway's Game of Life, and some parts of the code are proving tricky. The code I have now compiles and...
  23. Both. Here's the code I have now: #include...

    Both. Here's the code I have now:


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

    #define ARRAY_SIZE 30

    int main(int argc, char *argv[])
    {
  24. Alright, I did that, but it's still giving me a...

    Alright, I did that, but it's still giving me a huge number for some reason.

    I did the math myself, and sum is supposed to be equal to 2408, so the average is supposed to be about 80. When I run...
  25. Okay, I did a bit more work, and it's displaying...

    Okay, I did a bit more work, and it's displaying all the names and scores right, but I'm having problems figuring out how to keep a total of all the scores so I can use them to find the average and...
Results 1 to 25 of 31
Page 1 of 2 1 2