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

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

  1. #16
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,230

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

    Before the loop.
    int nTotal = 0;

    Inside the loop
    nTotal += maatriks[i][2]);

  2. #17
    Join Date
    Jan 2013
    Posts
    32

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

    question what exactly does "n total" mean and do? never heard of anything like that before

    EDIT, i tryed to add what u said in... but for some reason now when i activate the program, everything broke down int o massive ENDLESS ammount of numbers? so i dont know what to do agian
    well alteast i THINK i did it as u said....
    Last edited by SwiftXShadow; January 16th, 2013 at 09:48 AM.

  3. #18
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,230

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

    Quote Originally Posted by SwiftXShadow View Post
    question what exactly does "n total" mean and do? never heard of anything like that before
    There's no space between n and total.

  4. #19
    Join Date
    Jan 2013
    Posts
    32

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

    question what exactly does "n total" mean and do? never heard of anything like that before i think i am doing something wrong

    i put the int nTotal = 0; to the top where i declare all my other stuff like int i,j;

    and then nTotal += maatriks[i][3]); inside one of the loops? wow i just relized it is probably hard for you to understand half of my code because a lot of the words are written in first language

  5. #20
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,230

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

    Which part of there is no space between n and total was unclear?

  6. #21
    Join Date
    Jan 2013
    Posts
    32

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

    ou sorry, the first sentance of my second post somehow came along with my last one,

    i corrected the space but i still coulnt get it work, i think i am putting the nTotal += maatriks[i][3]); in the wrong place maybe? Where exactly in the code am i suppose to put it, the endless numbers stoped with the N fixing, but now simply nothing happens when i add that part? i must be doing something really wrong.

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

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

    Quote Originally Posted by SwiftXShadow View Post
    ou sorry, the first sentance of my second post somehow came along with my last one,

    i corrected the space but i still coulnt get it work, i think i am putting the nTotal += maatriks[i][3]); in the wrong place maybe? Where exactly in the code am i suppose to put it, the endless numbers stoped with the N fixing, but now simply nothing happens when i add that part? i must be doing something really wrong.
    Let's see what you have. If your instructor is right there, can you ask him/her?

  8. #23
    Join Date
    Jan 2013
    Posts
    32

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

    i think i put it in the loop.....(if i understand correctly what loop means..... it is an english word that i have never heard before, my programming is taught to me in my own language so i am trying really hard to get to the right place)

  9. #24
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,230

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

    Quote Originally Posted by SwiftXShadow View Post
    i think i put it in the loop.....(if i understand correctly what loop means..... it is an english word that i have never heard before, my programming is taught to me in my own language so i am trying really hard to get to the right place)
    Let's see your code.

  10. #25
    Join Date
    Jan 2013
    Posts
    32

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

    lol i wish, i can ask but they wont answer, as i said "i have to do it myself by any way i can find out how or feagure out how, he simply wont tell me how, so he isnt an option to find out form"

    also a LOT of the code is right now overlaping itself cuz i leave in every single thing i learned right now and once i get something done i delete out the crap. If anything is ununderstandebe because estonian i can translate most

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

    #define RIDU 4
    #define VEERGE 7
    #define MAX 150
    #define MIN 10

    int main (void)


    {



    int maatriks [RIDU] [VEERGE];
    int i,j;
    int nTotal = 0;

    srand(time(NULL));



    for(i=0; i<RIDU; i++)

    {
    for(j=0; j<VEERGE; j++)
    {

    maatriks[i][j]=rand()%(MAX-MIN)+MIN;
    }
    }



    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");
    }


    printf("========================================\n");
    printf("Kolmandast tulbast paremale jäävad tulbad\n");

    for(i=0; i<RIDU; i++)
    {
    for(j=0; j<VEERGE; j++)
    {

    if (j>2) printf("%4d", maatriks[i][j]);
    }
    printf("\n");
    }
    printf("========================================\n");




    printf("neljas tulp ja selle arvude summad\n");

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

    printf("viies tulp ja selle arvude summad\n");

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

    printf("kuues tulp ja selle arvude summad\n");

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

    printf("kuues tulp ja selle arvude summad\n");

    for(i=0; i<RIDU; i++)
    {
    for(j=0; j<VEERGE; j++)
    {

    if (j<1) printf("%4d", maatriks[i][6]);
    }
    printf("\n");
    }
    printf("----------------------------------------\n");



    printf("\n\n\n\n");

    printf("Neljas tulp ja selle arvude summad\n");


    j = 3;
    for(i=0; i<RIDU; i++)
    {

    printf(" %4d", maatriks[i][j]);

    }
    printf("\n");











    return 0;
    }

  11. #26
    Join Date
    Jan 2013
    Posts
    32

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

    i would use that speical box you guys use to put the code in, but i dont know how u guys get it

  12. #27
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,230

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

    You've been told several times you don't need a loop that increments the column variable. You've also been told several times that to access the third column, the index should be 2, not 3.

    This is what your summing loop should look like.

    Code:
    for(i=0; i<RIDU; i++)
    {
        nTotal += maatriks[i][2];
    }

  13. #28
    Join Date
    Jan 2013
    Posts
    32

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

    I dont need the third colum ( i need 4,5,6,7) i think i transalted that question in the start a bit wrong.

    And about the loop i dont really understand what that word means so i mix and matched things...

  14. #29
    Join Date
    Jan 2013
    Posts
    32

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

    so how do u get it on scr

  15. #30
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,230

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

    Quote Originally Posted by SwiftXShadow View Post
    I dont need the third colum ( i need 4,5,6,7) i think i transalted that question in the start a bit wrong.

    And about the loop i dont really understand what that word means so i mix and matched things...
    Then put the j loop back in, but start it at the first column you want to sum.

Page 2 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