Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. // Nieparzyste w macierzy.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. int _tmain(int argc, _TCHAR* argv[])
  9. {
  10.     int d, n, m;
  11.     int tab[500][500] = { 0 };
  12.  
  13.     cin >> d;
  14.  
  15.  
  16.     for (int i = 0; i < d; i++)
  17.     {
  18.         cin >> n;
  19.         cin >> m;
  20.  
  21.         for (int a = 1; a <= n; a++)
  22.         {
  23.             for (int b = 1; b <= m; b++)
  24.             {
  25.                 cin >> tab[a][b];
  26.             }
  27.         }
  28.  
  29.         for (int a = 1; a <= n; a++)
  30.         {
  31.             for (int b = 1; b <= m; b++)
  32.             {
  33.                 if (tab[a][b] % 2 != 0 && tab[a][b] != 0)
  34.                 {
  35.                     cout << tab[a][b] << " (" << b << "," << a << ")" << endl;
  36.                 }
  37.             }
  38.         }
  39.  
  40.     }
  41.     //system("PAUSE");
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement