I need very fast help, like within the hour, please! - Page 3
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 5 FirstFirst 12345 LastLast
Results 31 to 45 of 69

Thread: I need very fast help, like within the hour, please!

  1. #31
    Join Date
    Jan 2013
    Posts
    32

    Re: I need very fast help, like within the hour, please!

    what is j loop

    this part?

    printf("Genereeritud matrix on:\n\n");

    for(i=0; i<RIDU; i++)
    {
    for(j=0; j<VEERGE; j++)
    {
    printf("%4d", maatriks[i][j]);
    }
    printf("\n\n");
    }


    i dont get the "loop" word.
    Also since it is late here (17:33pm), my teacher told me to go home and finish it there and send it to him by midnight.... i gtg for like 30mins or so to get home and keep doing it there.

  2. #32
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,228

    Re: I need very fast help, like within the hour, please!


  3. #33
    Join Date
    Jan 2013
    Posts
    32

    Re: I need very fast help, like within the hour, please!

    soo loop is the thing that makes the programm repeat itself?

  4. #34
    Join Date
    Aug 2009
    Posts
    439

    Re: I need very fast help, like within the hour, please!

    SwiftXShadow, you really need to take the time to read that tutorial. I know you are feeling pressured right now, but if you can't grasp the concept of loops, then future assignments will just be that much harder. You should figure out how to sum all the numbers in a regular array. And then, once you have that down (using loops), you should read up on multidimensional arrays.

  5. #35
    Join Date
    Jan 2013
    Posts
    32

    Re: I need very fast help, like within the hour, please!

    Quote Originally Posted by Alterah View Post
    SwiftXShadow, you really need to take the time to read that tutorial. I know you are feeling pressured right now, but if you can't grasp the concept of loops, then future assignments will just be that much harder. You should figure out how to sum all the numbers in a regular array. And then, once you have that down (using loops), you should read up on multidimensional arrays.
    If i cant finish this code, then i will fail the class (there are no retests or anything, this class dosnt end with an exam but the assigments we are given at the end, which they call tests, are with about the same value, some of the stuff like how to add up the colums we have never talked about in any of our classes, they expect us to find information anyway possible to finish the so called test, or as i like to call it homework since we aren't obligated to do it in class), and then i wont have anymore assingments. Right now i am literally just trying to get it done any way possible.

  6. #36
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,844

    Re: I need very fast help, like within the hour, please!

    To format your code in the special code box, you need to 'go advanced' in posting a message - and not just use quick reply.

    Then select your code and click on the '#' in the formatting options that appear. If you then use Preview Post you should see your code formatted in the proper code box.

    Code:
    printf("Genereeritud matrix on:\n\n");
    
    for(i=0; i<RIDU; i++)
    {
    for(j=0; j<VEERGE; j++)
    {
    printf("%4d", maatriks[i][j]);
    }
    printf("\n\n");
    }
    It also helps if you format your code with indentations for block levels like this

    Code:
    printf("Genereeritud matrix on:\n\n");
    
    for(i=0; i<RIDU; i++) {
         for(j=0; j<VEERGE; j++) {
             printf("%4d", maatriks[i][j]);
         }
         printf("\n\n");
    }
    This helps yourself and anyone else trying to understand the code.

  7. #37
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,228

    Re: I need very fast help, like within the hour, please!

    Quote Originally Posted by SwiftXShadow View Post
    If i cant finish this code, then i will fail the class (there are no retests or anything, this class dosnt end with an exam but the assigments we are given at the end, which they call tests, are with about the same value, some of the stuff like how to add up the colums we have never talked about in any of our classes, they expect us to find information anyway possible to finish the so called test, or as i like to call it homework since we aren't obligated to do it in class), and then i wont have anymore assingments. Right now i am literally just trying to get it done any way possible.
    Then what will you do next time? You need to understand the fundamental concepts. Most of us write code that hasn't been written before, or code you can't just find a solution to on the net. You need to understand what the tools are, how they work, what they can do for you and how you can apply them. That's what your instructor is testing you on. Trying to pass a class without doing the requisite homework, then coming to a bulletin board and expecting your work to be done for you in and hour or two is an unrealistic expectation.

  8. #38
    Join Date
    Aug 2009
    Posts
    439

    Re: I need very fast help, like within the hour, please!

    If I understand the problem correctly, you have one matrix, A[4][7]. So, it's 4 rows and 7 columns. You need to then add the numbers starting at the third column going through the 7th column for each column correct?

    Consider a similar problem. You have to add all the numbers in column 3 and 4 together. For this problem, it's probably easier to do this a row at a time. You start with the first row. Grab the numbers starting at the third column and go to the last column. Then, you bump your row index up to the second row, etc. Consider the following matrix:

    Code:
    1 2 3 4
    5 6 7 9
    3 2 5 6
    That is a 3 X 4 matrix, lets call it Matrix.

    If I wanted to get the sum of all the numbers in the last two columns I would first initialize some counter to zero. I would start at the 3rd element in the above array from the first row, or Matrix[0][2]. I would add this onto the counter, then move onto the next element in the row, or Matrix[0][3]. At this point, I've run out of numbers in the row, so I need to jump down to the second row and start over, or to Matrix[1][2].

    But this isn't quite what your assignment is asking you to do. It looks like it wants you to add all the positive numbers from columns 3,4,5,6, and 7. So, instead of moving to the right in the above example, you need to move down, so you'll need to access Matrix[0][2], Matrix[1][2], and so forth. Once you get to the forth row Matrix[3][2], you'll now have your sum for that column. There's an additional requirement that the numbers you sum be positive, but that shouldn't be too difficult.

    The code for this assignment is not very difficult, and if you find yourself writing a bunch of code, you are probably doing something wrong.
    Last edited by Alterah; January 16th, 2013 at 12:49 PM.

  9. #39
    Join Date
    Jan 2013
    Posts
    32

    Re: I need very fast help, like within the hour, please!

    If i pass it then atleast i can keep trying to learn, i woulnt be on these forums if i didnt care if i failed or passed.

    And so far all the codes we had to write have been basically by the book, stuff we can look off our lectors examples and finish them.

    This time i just dont know how to do it, but i dont want to fail the class, and flunk out.

  10. #40
    Join Date
    Jan 2013
    Posts
    32

    Re: I need very fast help, like within the hour, please!

    so is it suppose to look like something like that to get the sum for the fourth column?

    Code:
    int nTotal = 0;
    
    
    {
        
    }
    
    
    printf("Fourth column and its sum\n");
    
    for(i=0; i<RIDU; i++)
    {
    for(j=0; j<VEERGE; j++)
    {
    	        	
     if (j<1)  printf("%4d", maatriks[i][3]);
                nTotal += maatriks[i][3]);
    }
    printf("\n");
    }

    though aside from the fact i dont know how to make it on the screen it feels like it is still missing a few lines of code...

  11. #41
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,228

    Re: I need very fast help, like within the hour, please!

    You're guessing without understanding. You can't code that way. I know you're under a deadline, but you don't seem to understand why you're doing what you're doing. You either want a j loop, or you want the second index hardwired, but not both, depending on whether you want to sum one column or multiple.

  12. #42
    Join Date
    Jan 2013
    Posts
    32

    Re: I need very fast help, like within the hour, please!

    I looked that https://www.youtube.com/watch?v=gZVg3pNOAtc short tutorial video video through about 3-4 times.... and and i noticed some similartys of what u were telling to me to what he is doing.


    EDIT: and what i want to do is sum up EACH of the columns sepretly?!

  13. #43
    Join Date
    Aug 2009
    Posts
    439

    Re: I need very fast help, like within the hour, please!

    SwiftXShadow, there isn't much more we can do without giving you the answer. GCDEF has given plenty of hints.

  14. #44
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,228

    Re: I need very fast help, like within the hour, please!

    Quote Originally Posted by SwiftXShadow View Post
    EDIT: and what i want to do is sum up EACH of the columns sepretly?!
    Is that a statement or a question? That seems to be your third different requirement now.

  15. #45
    Join Date
    Jan 2013
    Posts
    32

    Re: I need very fast help, like within the hour, please!

    i guess i failed explaning myself in english again.

    What i want to do is, sum each of the colums like

    Fourth colum 5+2+1+5=13
    fifth column 20+1+3+2=26
    sixth colum 12+8+5+12=37
    seventh column 2+4+6+8=20

    but it dosnt really matter that much anymore, i gotta send it in 28 minutes, so no way i will be able to feagure it out now, when i havent been able to for hours and hours.

Page 3 of 5 FirstFirst 12345 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center