Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import std.stdio;
- import std.file;
- import std.conv;
- import vibe.data.json;
- int main(string[] args) {
- string text = readText("../1.json");
- auto jval = parseJson(text);
- assert(!text.length);
- auto coordinates = jval["coordinates"];
- double x = 0;
- double y = 0;
- double z = 0;
- foreach (val; coordinates) {
- x += val["x"].get!double;
- y += val["y"].get!double;
- z += val["z"].get!double;
- }
- printf("%.8f\n%.8f\n%.8f\n", x / coordinates.length, y / coordinates.length, z / coordinates.length);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement