help with arrays
-
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<
-
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<
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.
-
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<
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
-
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<
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
-
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<