<em>#include "stdafx.h"</em>
<em>#include <iostream></em>
<em>#include <fstream></em>
using namespace <em>std</em>;
int _tmain(int argc, _TCHAR* argv[])
{
<span> bool s = false;
</span><span> char fn[255];
cout << <em>"Filename: "</em> << endl;
</span><span> cin >> fn;
</span> ifstream fin(fn);
while(!fin.eof())
<span> if (fin.get() == 's')
</span><span> {</span><span>
s = true;</span><span> break;</span><span>
}
</span> fin.close();
<span> cout << <em>"There "</em> << (s ? <em>"is"</em> : <em>"isn't"</em>) << endl;
</span> system(<em>"pause"</em>);
return 0;
<span>}</span>
Uses
graphABC;
const
W = 800; H = 500;
function DrawSin(x: real): real;
begin
DrawSin := sin(x);
end;
function DrawCos(x: real): real;
begin
DrawCos := cos(x);
end;
var
x0, y0, x, y, xLeft, yLeft, xRight, yRight, n: integer;
a, b, fmin, fmax, x1, y1, x2, y2, mx, my, dx, dy, num: real;
i: byte;
s: string;
begin
SetWindowSize(W, H);
xLeft := 50;
yLeft := 50;
xRight := W - 50;
yRight := H - 50;
a := -10; b := 10; dx := 1;
fmin := -5; fmax := 5; dy := 1;
mx := (xRight - xLeft) / (b - a);
my := (yRight - yLeft) / (fmax - fmin);
x0 := trunc(abs(a) * mx) + xLeft;
y0 := yRight - trunc(abs(fmin) * my);
line(xLeft, y0, xRight + 10, y0);
line(x0, yLeft - 10, x0, yRight);
SetFontSize(12);
SetFontColor(clBlue);
TextOut(xRight + 20, y0 - 15, 'X');
TextOut(x0 - 10, yLeft - 30, 'Y');
SetFontSize(7);
SetFontColor(clRed);
n := round((b - a) / dx) + 1;
for i := 1 to n do
begin
num := a + (i - 1) * dx;
x := xLeft + trunc(mx * (num - a));
Line(x, y0 - 3, x, y0 + 3);
str(Num:0:1, s);
if abs(num) > 1E-15 then
TextOut(x - TextWidth(s) div 2, y0 + 10, s)
end;
n := round((fmax - fmin) / dy) + 1;
for i := 1 to n do
begin
num := fMin + (i - 1) * dy;
y := yRight - trunc(my * (num - fmin));
Line(x0 - 3, y, x0 + 3, y);
str(num:0:1, s);
if abs(num) > 1E-15 then
TextOut(x0 + 7, y - TextHeight(s) div 2, s)
end;
TextOut(x0 - 10, y0 + 10, '0');
x1 := a;
x2 := a;
while x1 <= b do
begin
y1 := DrawSin(x1);
y2 := DrawCos(x2);
if ((x1 >= -2*pi) and (x1 <= 2*pi)) then
begin
x := x0 + round(x1 * mx);
y := y0 - round(y1 * my);
if (y >= yLeft) and (y <= yRight) then SetPixel(x, y, clBlue);
x := x0 + round(x2 * mx);
y := y0 - round(y2 * my);
if (y >= yLeft) and (y <= yRight) then SetPixel(x, y, clGreen);
end;
x1 := x1 + 0.001;
x2 := x2 + 0.001;
end
end.
var d, m:integer;
var h:real;
begin
readln(d);
m := d * 2;
h := m / 60;
m := m mod 60;
write('Количество часов = ' + Int(h) + ' количество минут = '+ m)
end.