//Поскольку вы не указали структуру файла и язык программирования, то подберу их сам.
//ЯП: C#
//Структура: рост/имя/вес/страна проживания
Код:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Prog
{
class Program
{
static void Main(string[] args)
{
string location = "C://Test//Persons.txt";
try
{
int size = File.ReadLines(location).Count();
if (size > 0)
{
List<string> person = new List<string>();
string[] tallestPerson = new string[4];
int maxHeight = -1;
int height = 0;
int index = 0;
StreamReader PersonsReader = new StreamReader(location, Encoding.Default);
for (int i = 0; i < size; i++)
{
person.Add(PersonsReader.ReadLine());
height = Convert.ToInt32(person[i].Remove(person[i].IndexOf("/")));
if (height > maxHeight)
{
maxHeight = height;
index = i;
}
}
string tmp = person[index];
int paramIndex = 0;
for (int j = 0; j < tmp.Length; j++)
{
if (tmp[j] != '/')
tallestPerson[paramIndex] += tmp[j];
else
paramIndex++;
}
Console.WriteLine("Самый высокий человек: " + tallestPerson[1]);
Console.WriteLine("Рост: " + tallestPerson[0] + " см");
Console.WriteLine("Вес: " + tallestPerson[2] + " кг");
Console.WriteLine("Страна проживания: " + tallestPerson[3]);
}
else
{
Console.WriteLine("Файл пустой!");
}
}
catch (Exception)
{
Console.WriteLine("Ошибка! Файл не нейден, либо нарушена его структура!");
}
finally
{
Console.ReadKey();
}
}
}
}




уточнять на каком языке программирования нужно написать задачки. Я же напишу на С++. Алгоритм везде будет один и тот же.
1 задача
int x1 = 0;
int x2 = 0;
int x3 = 0;
int x4 = 0;
int x5 = 0;
cin >> x1;
cin >> x2;
cin >> x3;
cin >> x4;
cin >> x5;
double sr = 0.0;
sr = (x1+x2+x3+x4+x5)/5;
Или же можно сделать по проще
int x = 0;
int sum = 0;
double sr = 0.0;
for(int i = 0; i<5; i++){
cin >> x;
sum = sum +x;
}
sr = sum/5;
2 Задача
int number = 5;
for(int i = 2; i<20; i=i+2){
number = number + i;
}