Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to make flowchart for matrix on C language?

How to make flowchart for matrix on C language?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_14777506
    wrote on last edited by
    #1

    Hi everyone, I have such a task: “Given an integer square matrix. Determine the minimum among the sums of diagonal elements parallel to the main diagonal of the matrix.” I have a code but I have problems compiling a flowchart for it, can you help me with compiling a flowchart or give tips? thanks in advance

    thats my code:

    #include
    #include
    #include
    #define N_MIN -3
    #define N_MAX 5
    int main(int argc, char *argv[]){
    int s,i,j,k,l,s1,t2,t1;
    int a[5][5];
    srand(time(NULL));
    for(i=0;i<5;i++){
    for(j=0;j<5;j++){
    a[i][j]=rand()%(N_MAX-N_MIN+1)+N_MIN;
    }
    }
    for(i=0;i<5;i++){
    for(j=0;j<5;j++){
    printf("%3d ",a[i][j]);
    }
    printf("\n");
    }
    k=0;
    s=0;
    l=0;
    for (i=0; i<5; i++){
    for (j=0; j<5; j++){
    if (a[i][j]>=0){
    if(a[i][j]%2==0)
    l+=a[i][j];
    k++;
    }
    }
    if (k==5){
    l=l;
    }
    else {
    l=0;
    }
    s=s+l;
    k=0;
    }
    s1=a[0][5-1];
    for(i=1; i<5; i++){
    t1=t2=0;
    for(j=0; j<5-i; j++){
    t1+=a[i+j][j];
    t2+=a[j][i+j];
    }
    if(t1

    J L 2 Replies Last reply
    0
    • M Member_14777506

      Hi everyone, I have such a task: “Given an integer square matrix. Determine the minimum among the sums of diagonal elements parallel to the main diagonal of the matrix.” I have a code but I have problems compiling a flowchart for it, can you help me with compiling a flowchart or give tips? thanks in advance

      thats my code:

      #include
      #include
      #include
      #define N_MIN -3
      #define N_MAX 5
      int main(int argc, char *argv[]){
      int s,i,j,k,l,s1,t2,t1;
      int a[5][5];
      srand(time(NULL));
      for(i=0;i<5;i++){
      for(j=0;j<5;j++){
      a[i][j]=rand()%(N_MAX-N_MIN+1)+N_MIN;
      }
      }
      for(i=0;i<5;i++){
      for(j=0;j<5;j++){
      printf("%3d ",a[i][j]);
      }
      printf("\n");
      }
      k=0;
      s=0;
      l=0;
      for (i=0; i<5; i++){
      for (j=0; j<5; j++){
      if (a[i][j]>=0){
      if(a[i][j]%2==0)
      l+=a[i][j];
      k++;
      }
      }
      if (k==5){
      l=l;
      }
      else {
      l=0;
      }
      s=s+l;
      k=0;
      }
      s1=a[0][5-1];
      for(i=1; i<5; i++){
      t1=t2=0;
      for(j=0; j<5-i; j++){
      t1+=a[i+j][j];
      t2+=a[j][i+j];
      }
      if(t1

      J Online
      J Online
      jeron1
      wrote on last edited by
      #2

      Can you write a line by line description of what this code does? Is this a question about the C language or or the typical symbols in flowcharts or something else?

      "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

      1 Reply Last reply
      0
      • M Member_14777506

        Hi everyone, I have such a task: “Given an integer square matrix. Determine the minimum among the sums of diagonal elements parallel to the main diagonal of the matrix.” I have a code but I have problems compiling a flowchart for it, can you help me with compiling a flowchart or give tips? thanks in advance

        thats my code:

        #include
        #include
        #include
        #define N_MIN -3
        #define N_MAX 5
        int main(int argc, char *argv[]){
        int s,i,j,k,l,s1,t2,t1;
        int a[5][5];
        srand(time(NULL));
        for(i=0;i<5;i++){
        for(j=0;j<5;j++){
        a[i][j]=rand()%(N_MAX-N_MIN+1)+N_MIN;
        }
        }
        for(i=0;i<5;i++){
        for(j=0;j<5;j++){
        printf("%3d ",a[i][j]);
        }
        printf("\n");
        }
        k=0;
        s=0;
        l=0;
        for (i=0; i<5; i++){
        for (j=0; j<5; j++){
        if (a[i][j]>=0){
        if(a[i][j]%2==0)
        l+=a[i][j];
        k++;
        }
        }
        if (k==5){
        l=l;
        }
        else {
        l=0;
        }
        s=s+l;
        k=0;
        }
        s1=a[0][5-1];
        for(i=1; i<5; i++){
        t1=t2=0;
        for(j=0; j<5-i; j++){
        t1+=a[i+j][j];
        t2+=a[j][i+j];
        }
        if(t1

        L Offline
        L Offline
        leon de boer
        wrote on last edited by
        #3

        Start by simply describing in english what each code section does, the flowchart will fall out from that. It will only be a problem if you didn't write the code yourself :-)

        In vino veritas

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups