ОбъясОтличник
program prog;
uses crt;
var a,b,v:integer;
begin
clrscr;
write('Возраст Антона = ');
readln(a);
write('Возраст Бориса = ');
readln(b);
write('Возраст Виктора = ');
readln(v);
writeln;
if (a>b)and(a>v) then writeln('Антон старше всех.');
if (b>a)and(b>v) then writeln('Борис старше всех.');
if (v>a)and(v>b) then writeln('Виктор старше всех.');
if (a=b)and(a>v) then writeln('Антон и Борис старше Виктора');
if (a=v)and(a>b) then writeln('Антон и Виктор старше Бориса');
if (b=v)and(b>a) then writeln('Борис и Виктор старше Антона');
if (a=b)and(a=v) then writeln('Антон,Борис и Виктор одного возраста');
end.
Подробнее - на -
#include <iostream> // header input/output streams
#include <fstream> // header для работы с файлами
using std::ifstream; // для работы с файлом input.txt
using std::ofstream; // для работы с файлом output.txt
using std::cin; // для работы cin
using std::cout; // для работы cout
using std::endl; // для работы перевода на новую строку endl
int main(){
ifstream in_file;
ofstream out_file;
try{
in_file.open("input.txt");
out_file.open("output.txt");
}
catch(std::exception& e){
cout << e.what() << endl;
}
unsigned int a,b;
in_file >> a >> b;
unsigned int sum = a+b -1;
cout << sum;
out_file << sum - a << ' ' << sum-b << endl;
}
1 - 7 + 8 + 9 = 24;
2 - 5 + 6 + 7 = 18;