lr 3 #2

Merged
angelina merged 113 commits from v.moiseev/distributed-computing:main into main 2023-12-07 18:07:15 +04:00
3 changed files with 6 additions and 31 deletions
Showing only changes of commit 685fd6ab9b - Show all commits

View File

@ -1,5 +0,0 @@
{
"version": 1,
"isRoot": true,
"tools": {}
}

View File

@ -2,11 +2,11 @@
using System.IO;
using System.Net.Http;
var dir = new DirectoryInfo("../var/data");
var dir = new DirectoryInfo("/var/data");
var files = dir.GetFiles();
string resultFilePath = "../var/result/data.txt";
string resultFilePath = "/var/result/data.txt";
try
{
int[] mass = new int[files.Length];

View File

@ -1,32 +1,12 @@
using System;
using System.IO;
using System.Linq;
string[] lines = File.ReadAllLines("../var/data/data.txt");
string[] lines = File.ReadAllLines("/var/data/data.txt");
int firstNumber = 0;
int lastNumber = 0;
int multiplication = Convert.ToInt32(lines.First()) * Convert.ToInt32(lines.Last());
foreach (string line in lines)
{
if (int.TryParse(line, out int number))
{
firstNumber = number;
break;
}
}
for (int i = lines.Length - 1; i >= 0; i--)
{
if (int.TryParse(lines[i], out int number))
{
lastNumber = number;
break;
}
}
int multiplication = firstNumber * lastNumber;
using (StreamWriter writer = new StreamWriter("../var/result/result.txt"))
using (StreamWriter writer = new StreamWriter("/var/result/result.txt"))
{
writer.WriteLine(multiplication);
}