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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. help with arrays

help with arrays

Scheduled Pinned Locked Moved C / C++ / MFC
regexhelptutorial
5 Posts 5 Posters 0 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.
  • K Offline
    K Offline
    klutez123
    wrote on last edited by
    #1

    I am looking for help how to output a chart into the arrays, all i was given was that i need to put a loop inside of a loop. The chart given is: 0 0 0 0 0 1 2 3 0 2 4 6 0 3 6 9 This is what I have so far: // Compiler Directives #include "stdafx.h" #include "pattern.h" #include #include #include #include #include // Global Declarations using namespace std; CWinApp TheApp; /***************************************************** * MAIN * *****************************************************/ int main() { int j; int i; int test_score[4][4]; for(i = 0; i < 4; i++) { for(j= 0; j < 4; j++) { test_score[i][j] = 0; cout<< test_score[i][j]; } cout<

    CPalliniC D J M 4 Replies Last reply
    0
    • K klutez123

      I am looking for help how to output a chart into the arrays, all i was given was that i need to put a loop inside of a loop. The chart given is: 0 0 0 0 0 1 2 3 0 2 4 6 0 3 6 9 This is what I have so far: // Compiler Directives #include "stdafx.h" #include "pattern.h" #include #include #include #include #include // Global Declarations using namespace std; CWinApp TheApp; /***************************************************** * MAIN * *****************************************************/ int main() { int j; int i; int test_score[4][4]; for(i = 0; i < 4; i++) { for(j= 0; j < 4; j++) { test_score[i][j] = 0; cout<< test_score[i][j]; } cout<

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Well, you have put zero in all of the array values. What do you need now? :confused: :zzz:

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

      In testa che avete, signor di Ceprano?

      1 Reply Last reply
      0
      • K klutez123

        I am looking for help how to output a chart into the arrays, all i was given was that i need to put a loop inside of a loop. The chart given is: 0 0 0 0 0 1 2 3 0 2 4 6 0 3 6 9 This is what I have so far: // Compiler Directives #include "stdafx.h" #include "pattern.h" #include #include #include #include #include // Global Declarations using namespace std; CWinApp TheApp; /***************************************************** * MAIN * *****************************************************/ int main() { int j; int i; int test_score[4][4]; for(i = 0; i < 4; i++) { for(j= 0; j < 4; j++) { test_score[i][j] = 0; cout<< test_score[i][j]; } cout<

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        klutez123 wrote:

        all i was given was that i need to put a loop inside of a loop.

        I agree.

        klutez123 wrote:

        test_score[i][j] = 0; cout<< test_score[i][j];

        Study these two statements carefully. What does it look like they are doing? Do you see anything that would look like it would produce the "chart" you are after?


        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        1 Reply Last reply
        0
        • K klutez123

          I am looking for help how to output a chart into the arrays, all i was given was that i need to put a loop inside of a loop. The chart given is: 0 0 0 0 0 1 2 3 0 2 4 6 0 3 6 9 This is what I have so far: // Compiler Directives #include "stdafx.h" #include "pattern.h" #include #include #include #include #include // Global Declarations using namespace std; CWinApp TheApp; /***************************************************** * MAIN * *****************************************************/ int main() { int j; int i; int test_score[4][4]; for(i = 0; i < 4; i++) { for(j= 0; j < 4; j++) { test_score[i][j] = 0; cout<< test_score[i][j]; } cout<

          J Offline
          J Offline
          John R Shaw
          wrote on last edited by
          #4

          Give this a try

          int test_score[4][4] = {
          {0, 0, 0, 0},
          {0, 1, 2, 3},
          {0, 2, 4, 6},
          {0, 3, 6, 9} };

          ...
          cout << test_score[i][j] << ' ';
          ...

          INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

          1 Reply Last reply
          0
          • K klutez123

            I am looking for help how to output a chart into the arrays, all i was given was that i need to put a loop inside of a loop. The chart given is: 0 0 0 0 0 1 2 3 0 2 4 6 0 3 6 9 This is what I have so far: // Compiler Directives #include "stdafx.h" #include "pattern.h" #include #include #include #include #include // Global Declarations using namespace std; CWinApp TheApp; /***************************************************** * MAIN * *****************************************************/ int main() { int j; int i; int test_score[4][4]; for(i = 0; i < 4; i++) { for(j= 0; j < 4; j++) { test_score[i][j] = 0; cout<< test_score[i][j]; } cout<

            M Offline
            M Offline
            malaugh
            wrote on last edited by
            #5

            you need to replace the line test_score[i][j] = 0; with a formula that will give the chart in the answer for example test_score[i][j] = i + j; would give 0 1 2 3 1 2 3 4 2 3 4 5 3 4 5 6 think about it.

            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