nestedloop - int numbers[3][3]; // =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* This is the solution to the problem in EXAM01-version D that required the you to create a matrix, implicitly, that looked like: 2 4 6 2 4 6 2 4 6 and to display it in this format. This question was 20% of the exam grade */ #include <iostream> using namespace std; int main(){ // explicityly if we assigned values when initializing array // however, the problem said implicitly
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: int numbers[3][3]; // = {{2,4,6},{2,4,6},{2,4,6}}; // cout &lt;&lt; numbers; // traverse through rows for(int k =0; k&lt;3; k++){ //cout&lt;&lt;numbers[k][1]&lt;&lt;endl; // traverse through columns for(int t = 0; t&lt;3; t++){ if(t==0) numbers[k][t] = 2; else if(t==1) numbers[k][t] = 4; else numbers[k][t] = 6; cout &lt;&lt; numbers[k][t] &lt;&lt;&quot;\t&quot;; } cout&lt;&lt;endl; } return 0; }...
View Full Document

Ask a homework question - tutors are online