#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; // input.txt
ofstream out_file; //output.txt
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;
}
#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;
}
Поделитесь своими знаниями, ответьте на вопрос:
a:array[1..18] of integer;
i,n,n2,max:integer;
Begin for i:=1 to 18 do Begin
case i of
1..6:begin Write('Введите ',i,'-ую оценку по обязательной программе '); Readln(a[i]); n:=n+a[i]; if i=6 then Begin max:=n; n:=0; n2:=1; End; End;
7..12:Begin Write('Введите ',i-6,'-ую оценку по короткой программе '); Readln(a[i]); n:=n+a[i]; if i=12 then Begin if n>max then Begin max:=n; n2:=2;End; n:=0; End; End;
13..18:Begin Write('Введите ',i-12,'-ую оценку по произвольной программе '); Readln(a[i]); n:=n+a[i]; if i=18 then Begin if n>max then Begin max:=n; n2:=3;End; n:=0; End; End;
end;
end;
case n2 of
1: write('Лучшая оценка по обязательной программе = ',max);
2: write('Лучшая оценка по короткой программе = ',max);
3: write('Лучшая оценка по произвольной программе = ',max);
End;
End.