lab2 - elements"<<endl;...

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

View Full Document Right Arrow Icon
#include<iostream> # using namespace std; u #define MAX_ROWS 3 #define MAX_COLUMNS 2 # int Odd(int A[MAX_ROWS][MAX_COLUMNS],int,int); i int main() { int A[MAX_ROWS][MAX_COLUMNS] = { {3 , 2}, {4 , 5}, {2 , 2} }; i int length=MAX_ROWS; int width=MAX_COLUMNS; i cout<<"The matrix A={{3,2}, {4,5}, {2,2}} has "<<Odd(A,length,width)<<" odd
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: elements&quot;&lt;&lt;endl; e return 0; } int Odd(int A[MAX_ROWS][MAX_COLUMNS],int length,int width) { int totalOdd=0; i for(int row=0;row&lt;length;row++) { for(int col=0;col&lt;width;col++) { if(A[row][col]%2==1) totalOdd++; } } return totalOdd; }...
View Full Document

This note was uploaded on 04/25/2010 for the course CECS CIS 200 taught by Professor Jieshen during the Winter '08 term at University of Michigan-Dearborn.

Ask a homework question - tutors are online