Guest User

Untitled

a guest
Jan 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.11 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.IO;
  10.  
  11. namespace _114_Assignment7_Task5
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.        
  16.  
  17.         public Form1()
  18.         {
  19.             InitializeComponent();
  20.         }
  21.  
  22.         private void Form1_Load(object sender, EventArgs e)
  23.         {
  24.  
  25.         }
  26.     }
  27.  
  28.     public class MaxArray
  29.     {
  30.         public class MaxArray
  31.         {
  32.             private int[,] matrix;
  33.  
  34.             public MaxArray(string arrayFileName, int m, int n)
  35.             {
  36.                 matrix = new int[m, n];
  37.  
  38.                 FileStream file = new FileStream(arrayFileName, FileMode.Open, FileAccess.Read);
  39.                 StreamReader reader = new StreamReader(file);
  40.  
  41.  
  42.                 // verify "arrayFileName" is actually a valid file that exists
  43.                 // open the file
  44.                 // read the contents into m_matrix[][]
  45.                 // make sure you are safe not to accidentally go out of bounds on array
  46.             }
  47.  
  48.             public int MaxFinder(int m, int n)
  49.             {
  50.                 int maxValue = 0;
  51.                 int max = 0;
  52.                 int M = 0;
  53.  
  54.                 if (m > maxValue)
  55.                 {
  56.                     maxValue = m;
  57.                 }
  58.                 else if (n > maxValue)
  59.                 {
  60.                     maxValue = n;
  61.                 }
  62.                 return maxValue;
  63.  
  64.                 max = matrix[0, 0];
  65.                 for (int row = 0; row < M; row++)
  66.                     for (int column = 0; column < N; column++)
  67.                     {
  68.                         if (matrix[row, column] > max)
  69.                             max = matrix[row, column];
  70.                     }
  71.                 return max;
  72.  
  73.                 // loop through all rows & columns of m_matrix
  74.                 // if (value > maxValue)
  75.                 // store biggest value
  76.                 // should we PRINT OUT the value?
  77.             }
  78.         }
  79.  
  80.  
  81.  
  82.     }
  83. }
Add Comment
Please, Sign In to add comment