- •Звіт про виконання навчальної практики
- •План Робота в Microsoft Visio Короткі теоретичні відомості про Microsoft Visio
- •Задачі Короткі теоретичні відомості про c#
- •Короткі теоретичні відомості про Delphi
- •Задача №1
- •Задача №2
- •Задача №3
- •Задача №1
- •Задача №2
- •Задача №3
- •Робота в Adobe Photoshop Короткі теоретичні відомості про Adobe Photoshop
- •Робота зі складними об’єктами
- •Робота в LaTeX Короткі теоретичні відомості про LaTeX
- •Висновки
Задача №3
Дана дійсна матриця розміром 20×30. Впорядкувати її рядки по зростанню сум їх елементів.
Реалізація на С#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace pr273
{
class Program
{
static void Main(string[] args)
{
const int r = 4, s = 2;
double[,] mas = new double[r, s];
Random rand = new Random();
double temp;
for (int i = 0; i < r; i++)
{
for (int j = 0; j < s; j++)
{
mas[i, j] = double.Parse(Console.ReadLine());
}
}
for (int i = 0; i < r; i++)
{
for (int j = 0; j < s; j++)
{
Console.Write(mas[i,j]+" ");
}
Console.WriteLine();
}
double[] sum = new double[r];
for (int i = 0; i < r; i++)
sum[i]=0;
for (int i = 0; i < r; i++)
{
for (int j = 0; j < s; j++)
{
sum[i] += mas[i, j];
}
}
Console.WriteLine();
double max = 100000000;
double min = 0;
int im = 0;
for (int i=0; i<r; i++)
{
min = sum[i];
im = i;
for (int k = 0; k < r; k++)
{
if (min > sum[k])
{
min = sum[k];
im=k;
}
}
sum[im] = max;
for (int j = 0; j < s; j++)
{
Console.Write(mas[im, j] + " ");
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
Варіант 28
Задача №1
Дана послідовність слів, розділених комами, за останнім – крапка. Записати в файл слова, які мають більше 2 голосних літер.
Реалізація на C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
namespace pr281
{
class Program
{
static void Main(string[] args)
{
StreamWriter sw = new StreamWriter("D:\\text.txt");
string s=Console.ReadLine();
int val1=0, val2=0;
char c = s[0];
int curr = 0;
for (int i = 0; i < s.Length; i++)
{
if (s[i] == ',' || s[i] == '.')
{
val1 = val2;
val2 = i;
if (val1 != 0)
val1++;
if (curr >= 2)
{
for (int j = val1; j < val2; j++)
sw.Write(s[j]);
sw.WriteLine();
}
curr = 0;
}
else if (s[i] == 'a' || s[i] == 'e' || s[i] == 'u' || s[i] == 'i' || s[i] == 'o' || s[i] == 'y')
{
curr++;
}
}
sw.Close();
}
}
}
Реалізція на Delphi:
program Project2;
{$APPTYPE CONSOLE}
uses
SysUtils;
Var sw:textFile;
s:string;
val1, val2, curr, i:integer;
c:char;
begin
{ TODO -oUser -cConsole Main : Insert code here }
AssignFile(sw, 'f.txt');
ReWrite(sw);
ReadLn(s);
val1:=0; val2:=0;
c:= s[1];
curr := 0;
for i:= 1 to Length(s)
begin
if (s[i] = ',' or s[i] = '.') then
begin
val1 := val2;
val2 := i;
if (val1 <> 0)
inc(val1);
if (curr >= 2) then
begin
for (int j = val1; j < val2; j++)
Write(sw,s[j]);
WriteLn(sw);
end;
curr := 0;
end;
else if (s[i] == 'a' || s[i] == 'e' || s[i] == 'u' || s[i] == 'i' || s[i] == 'o' || s[i] == 'y')
begin
inc(curr);
end;
end;
CloseFile(sw);
end.