ответ:
#include "stdafx.h"
#include
using namespace std;
struct complex // структура "хранения" комплексного числа
{ float re; // действительная часть
float im; // мнимая часть
};
void print( char * txt, complex x) // вывод комплексного числа
{
printf("%s=(%f,%fi)", txt, x.re, x.im);
return;
};
complex new_complex(float a, float b) // задать значение комплексному числу
{ complex temp;
temp.re=a;
temp.im=b;
return temp;
};
complex plus_complex(complex a, complex b) // сложить два комплексных чисел
{ complex temp;
temp.re=a.re+b.re;
temp.im=a.im+b.im;
return temp;
}
int main() // простая тестовая программа
{
complex z;
printf( "vvedite re и im 1 chisla: ");
cin > > z.re > > z.im;
print( "z", z); printf("\n");
complex q;
printf( "vvedite re и im 2 chisla: ");
cin > > q.re > > q.im;
print("q", q); printf("\n");
complex sum;
sum=plus_complex(z,q);
print("q+z", sum); printf("\n");
return 0;
}
0
var t: real;
begin
t := a;
a := b;
b := t;
end;
var a, b, c: real;
begin
readln(a, b, c);
if (a > b) then swap(a, b);
if (b > c) then swap(b, c);
if (a > b) then swap(a, b);
writeln(a, ' ', b, ' ', c);
end.
Без процедур:
var a, b, c, t: integer;
begin
readln(a, b, c);
if (a > b) then
begin
t := a;
a := b;
b := t;
end;
if (b > c) then
begin
t := b;
b := c;
c := t;
end;
if (a > b) then
begin
t := a;
a := b;
b := t;
end;
writeln(a, ' ', b, ' ', c);
end.