Черников / Домашние задания / ДЗ-5 / Задание / 34 / Вариант_16
.docЗадача 1.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
char r;
do
{
double[][] mas;
int a, i;
ArrayList masd;
masd = new ArrayList();
mas = new double[5][];
for (i = 0; i != 5; i++)
{
Console.WriteLine("введите количество эелементов строки");
a = int.Parse(Console.ReadLine());
mas[i] = new double[a];
}
Console.WriteLine("исхоодный масив масивов:");
methods.zap(mas);
Console.WriteLine();
methods.viv(mas);
Console.WriteLine();
Console.WriteLine("масив положительных чисел:");
methods.opr(mas);
Console.WriteLine(" для продолжения нажмиет y");
r = char.Parse(Console.ReadLine());
Console.WriteLine();
} while (r == 'y');
}
}
}
Задача 2.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int[,] a;
//int[][] newarray;
int n, m,
i,j;
ConsoleKeyInfo клавиша;
MyClass ob=new MyClass();
do
{
Console.WriteLine("Введите размер массива");
Console.WriteLine("Введите количество столбцов");
string str = Console.ReadLine();
m = int.Parse(str);
Console.WriteLine("Введите количество строк");
str = Console.ReadLine();
n=int.Parse(str);
for (i = 0; i < m; i++)
for (j = 0; j < n; j++)
a[i, j] = 0;
ob.RandomGenerator(a, m, n);
ob.Print(a, m, n);
Console.WriteLine("Для выхода нажмите Esc");
клавиша = Console.ReadKey(true);
}
while (клавиша.Key != ConsoleKey.Escape);
}
}
}
Задача 3.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double x,
y;
int flag;
string str;
Console.Title = ("Программа для определения принадлежности точки к окружности");
Console.ForegroundColor = ConsoleColor.DarkYellow;
Console.BackgroundColor = ConsoleColor.DarkRed;
ConsoleKeyInfo ans;
do
{
Console.Clear();
Console.WriteLine("Введите значение 'x'");
Console.WriteLine("ВНИМАНИЕ!!! для отделения целой части используйте символ ','");
x = double.Parse(Console.ReadLine());
Console.WriteLine("Введите значение 'y'");
y = double.Parse(Console.ReadLine());
Console.WriteLine("Идёт подсчет... Вы будете оповещены звуковым сигналом, после выполнения процесса");
if (y < 2 && y > 0 && y <= -2 * x + 2 && y <= 2 * x + 2)
flag = 1;
else flag = 2;
if (flag == 1)
str = ("(точка принадлежит области)");
else str = ("(точка не принадлежит области)");
Console.WriteLine("flag = " + flag + " " + str);
Console.Beep(100, 500);
Console.WriteLine("Если хотите повторить, нажмите Enter.");
Console.WriteLine("Для выхода нажмите Esc.");
ans = Console.ReadKey(true);
} while (ans.Key != ConsoleKey.Escape);
}
}
}