int, float
int
#include "stdafx.h"
#include <iostream>
#include <conio.h>
using namespace std;
const int N = 4;
void raschet(int a, int c, int d[])
{int g, k, l, z;
int Y = 0;
g = 2 * c;
k = a*a + 1;
cout << "g = " << "2 * " << c << " = " << g << endl;
cout << "k = " << a*a << " + 1" << " = " << k << endl;
for (int i = 1; i <= N; i++)
{l = d[i] / 4;
cout << i << ") " << "l[" << d[i] << "] = " << d[i] << " / 4 = " << l << endl;
z = (g - l) / k;
cout << " z[" << d[i] << "] = " << z << endl;
Y = Y + z;
cout << endl;}
cout << "Y = " << Y << endl;}
int main()
{setlocale(LC_ALL, "Russian");
int a, c, d[N];
cout << " a = ";
cin >> a;
cout << " = ";
cin >> c;
cout << " " << endl;
for (int i = 1; i <= N; i++)
{cout << "d[" << i << "] = ";
cin >> d[i];}
raschet(a, c, d);
_getch();
return 0;}
float
#include "stdafx.h"
#include <iostream>
#include <conio.h>
using namespace std;
const int N = 4;
void raschet(float a, float c, float d[])
{float g, k, l, z;
float Y = 0;
g = 2 * c;
k = a*a + 1;
cout << "g = " << "2 * " << c << " = " << g << endl;
cout << "k = " << a*a << " + 1" << " = " << k << endl;
for (int i = 1; i <= N; i++)
{l = d[i] / 4;
cout << i << ") " << "l[" << d[i] << "] = " << d[i] << " / 4 = " << l << endl;
z = (g - l) / k;
cout << " z[" << d[i] << "] = " << z << endl;
Y = Y + z;
cout << endl;}
cout << "Y = " << Y << endl;}
. 230100.7.1.00 |
int main()
{setlocale(LC_ALL, "Russian");
float a, c, d[N];
cout << " a = ";
cin >> a;
cout << " = ";
cin >> c;
cout << " " << endl;
for (int i = 1; i <= N; i++)
{cout << "d[" << i << "] = ";
cin >> d[i];}
raschet(a, c, d);
_getch();
return 0;}
z=(2*c-d[i]/4)/(a*a-1) y=y+z |
i<5 |
i=0, y=0 |
a, c, d[i] |
|
|
. |
. |
y |
. 230100.7.1.00 |
3.
.
.
Ex77 start 0
lda c
mul c2
sta p
ldx c0
lda c0
usl comp c12
jgt art
jeq art
jsub inc
rmo x,a;i:=i+1
add c3
rmo a,x
j usl
art lda y
hlt
c word 20
e word 2
c0 word 0
c1 word 1
c3 word 3
c4 word 4
c12 word 12
c2 word 2
y word 0
d word 20
word 12
word 4
word -16
o resb 3
k resb 3
p resb 3
inc lda e
mul e
add c1
sta k
lda d,x
div c4
sta o
lda p
sub o
div k
add y
sta y
rsub
end Ex77
. 230100.7.1.00 |
inc
.
.
. 230100.7.1.00 |
IBM
. |
. |
. 230100.7.1.00 |
IBM PC
InputInt proc
mov ah, 0ah
xor di, di
mov dx, offset buff;
int 21h;
mov dl, 0ah
mov ah, 02
int 21h
;
;
mov si, offset buff+2;
cmp byte ptr [si], "-";
jnz ii1
mov di, 1;
inc si;
ii1: xor ax, ax
mov bx, 10; c
ii2: mov cl, [si];
cmp cl, 0dh;
jz endin
; ,
;
cmp cl, '0'; <0
jl er
cmp cl, '9'; >9
ja er
sub cl, '0';
mul bx; 10
add ax, cx;
inc si;
jmp ii2;
er: mov dx, offset error; ,
;
mov ah,09
int 21h
int 20h;
; ax
endin: cmp di,1; ,
jnz ii3
neg ax;
ii3: ret
error db "incorrect number$"
buff db 6,7 Dup(?)
InputInt endp
. 230100.7.1.00 |
. |
. |
IBM PC
. |
. |
OutInt proc near;=====
test ax, ax; .
jns oi1
mov cx, ax; e ,
;
mov ah, 02h
mov dl, '-'
int 21h
mov ax, cx
neg ax
oi1: xor cx, cx; CX
mov bx, 10; . 10 ..
oi2: xor dx, dx
div bx; ,
;
|
|
push dx; ,
;
inc cx
; ,
;
test ax, ax; , ,
;,
jnz oi2;
;=================
mov ah, 02h
oi3: pop dx
add dl, '0'; ,
;
int 21h
loop oi3; ,
;
ret
OutInt endp
. 230100.7.1.00 |
. 230100.7.1.00 |
. |
. |