|
|
|
|
Автор:
|
Anonymous
|
|
Тема:
|
Помогите разобраться
|
|
Дата:
|
2/28/2008 1:03:00 PM
|
Не могли бы вы написать коментарии к этой программе (что она выполняет в каждой строке), очень надо!
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please, enter N:");
int N = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please, enter M:");
int M = Convert.ToInt32(Console.ReadLine());
int[,] matrix = new int[N, M];
Random rndGenerator = new Random();
int[] columnSum = new int[N];
for (int x = 0; x < N; x++)
{
columnSum[x] = 0;
for (int y = 0; y < M; y++)
{
matrix[x, y] = rndGenerator.Next(10);
Console.Write("{0}\t", matrix[x, y]);
}
Console.WriteLine("\n");
}
Console.WriteLine("========================================\n");
for (int x = 0; x < N; x++)
for (int y = 0; y < M; y++)
columnSum[x] += matrix[y, x];
for (int x = 0; x < N; x++)
Console.Write("{0}\t", columnSum[x]);
Console.ReadLine();
}
}
}
|
|
|
|