.section .data
hello_str:
.ascii "Hello, world!\n"
.set hello_str_length, . - hello_str
.section .text
.global main
.type main, @function
main:
movq $4, %rax
movq $1, %rbx
movq $hello_str, %rcx
movq $hello_str_length, %rdx
int $0x80
movq $1, %rax
movq $0, %rbx
int $0x80
.size main, . - main
.file "test.c"
.section .rodata
.LC0:
.string "Hello, World!"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movl %edi, -4(%rbp)
movq %rsi, -16(%rbp)
leaq .LC0(%rip), %rdi
call puts@PLT
movl $0, %eax
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Debian 6.3.0-18) 6.3.0 20170516"
.section .note.GNU-stack,"",@progbits
jpgout := TJPEGImage.Create;
try
with jpgout do
begin
Assign(Image1.Picture.Bitmap);
SaveToFile('myfile.jpg');
end;
finally
jpgout.Free;
end;
#include <stdio.h>
#include <math.h>
double f(x) {
double x2 = x * x;
return x2 * x2 + 2 * sin(x2);
}
double f1(z) {
return sin(z) + tg(z);
}
double f2(z) {
double cz = cos(z);
return cz * cz * cz + 3/z;
}
double f3(z) {
double z2 = z * z;
return z2 + log(z);
}
int main() {
double c = 3.2;
double z = cos(c);
double x;
if (z < 0) {
x = f1(z);
} else if (z < 8) {
x = f2(z);
} else {
x = f3(z);
}
double result = f(x);
printf('%f\n', result);
}
type
TArrayHelper<T> = class
class procedure CoolProc(var arr: TArray<T>); // Ваша процедура
end;
…
implementation
class procedure TArrayHelper<T>.CoolProc(var arr: TArray<T>); // Реализация Вашей процедуры
var
Tmp: T;
begin
Tmp := arr[0];
arr[0] := arr[4];
arr[4] := Tmp;
end;
procedure TForm1.Button1Click(Sender: TObject); // Проверка работы
var
i: integer;
iarr: TArray<Integer>;
sarr: TArray<String>;
begin
iarr := TArray<Integer>.Create(1, 2, 3, 4, 5);
sarr := TArray<String>.Create('one', 'two', 'three', 'four', 'five');
TArrayHelper<Integer>.CoolProc(iarr); // Вызов для целых чисел
TArrayHelper<String>.CoolProc(sarr); // Вызов для строк
for I := 0 to 4 do
begin
memo1.Lines.Add(IntToStr(iarr[i]));
memo2.Lines.Add(sarr[i]);
end;
end;
student_struct = {}
summ = 0
summ = 0
for individual_mark in all_marks:
summ += individual_mark
sum(all_marks)
all_marks = student['marks']
student_struct = {}
student_struct['name'] = individual_name
student_struct['average'] = summ
student_struct = {
'name': student['Name'],
'average': sum(student['marks'])
}
students_data = [
{'name': 'Vasya', 'marks': [4, 5, 4, 5, 5]},
{'name': 'Petya', 'marks': [3, 5, 3, 4, 2, 2]},
{'name': 'Ivan', 'marks': [4, 5, 4, 4, 4, 4]},
{'name': 'Dima', 'marks': [4, 5, 4, 3, 3, 3]},
]
average_data = [{'name': student['name'], 'average': sum(student['marks'])} for student in students_data]
int tmp = start ^ finish;
int tmp = start ^ finish;
hanoi( height - 1, start, tmp );
hanoi( 1, start, finish );
hanoi( height - 1, tmp, finish );
a = b[:]
# или
a = b.copy()
b = [1, 2]
>>> b.append(b)
>>> b
[1, 2, [...]]
>>> id(b)
139920848119752
>>> id(b[2])
139920848119752
>>> a = b[:]
>>> a
[1, 2, [1, 2, [...]]]
>>> id(a)
139920848120456
>>> id(a[2])
139920848119752
from copy import deepcopy
>>> a = deepcopy(b)
>>> a
[1, 2, [...]]
>>> id(a)
139920847744840
>>> id(a[2])
139920847744840
return a==b ? (a==c ? d : c) : (a==c ? b : a);
int X[4];
return X[(X[0]==X[2])+2*(X[0]==X[1])];
int f(int p,int q,int r){
return p==r ? q : p;
}
int g(int a,int b,int c,int d){
return a==b ? f(c,d,a) : f(a,b,c);
}
int x=a^b,y=a^c;
x=(x|-x)>>31; y=(y|-y)>>31;
return ((a^b^c^d)&x&y)^((b^d)&x)^((c^d)&y)^d;
если ты такой умный - покажи какую фразу вбить в гугля.