x = float('40.80')
a = int(x)
b = int(100 * (x - a))
print(a, b) # => 40 79
from decimal import Decimal
x = Decimal('40.80')
a = int(x)
b = int(100 * (x - a))
print(a, b) # => 40 80
a, b = map(int, '40.80'.split('.'))
print(a, b) # => 40 80
$data = [...]; // ваши данные
$data = array_filter($data, function($item) {
return $item['x'] == 2;
});
$data = array_map(function($item) {
return $item['y'];
}, $data);
$max = max($data);
$data = [...]; // ваши данные
$max = max(array_map(
function($item) {
return $item['y'];
},
array_filter($data, function($item) {
return $item['x'] == 2;
})
));
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char line[] = " abc def, ghi ";
char *arr[3];
char *p;
p = line;
for (int i = 0; i < 3; i++) {
p = strtok(p, " ,");
if (p) {
arr[i] = p;
p = NULL;
} else {
break;
}
}
for (int i = 0; i < 3; i++) {
cout << arr[i] << endl;
}
return 0;
}
[guest@localhost cpp]$ .iso++ t.cpp -o t
[guest@localhost cpp]$ ./t
abc
def
ghi
[guest@localhost cpp]$