online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include <cassert> #include <algorithm> #include <vector> using float64 = float; void Sort(std::vector<float64>& points) { assert(points.size() % 3 == 0); struct Point { float64 X, Y, Z; }; auto begin = static_cast<Point*>(static_cast<void*>(points.data())); auto end = begin + points.size() / 3; std::sort(begin, end, [](const Point& ptLeft, const Point& ptRight){ return ptLeft.Z < ptRight.Z; }); } void printCoords (const std::vector<float64>& coords){ for(auto it = coords.begin(); it != coords.end();) { for(int i = 0; i < 3; ++i) { std::cout << " X=" << *it++; std::cout << " Y=" << *it++; std::cout << " Z=" << *it++; std::cout << std::endl; } } } int main() { std::vector<float64> coords; coords.insert(coords.end(), { 0.0F, 0.0F,0.0F}); coords.insert(coords.end(), { -1.0F, -1.0F, -1.0F}); coords.insert(coords.end(), { 1.0F, 1.0F, 1.0F}); std::cout << "Before sort\n"; printCoords(coords); Sort(coords); std::cout << "After sort\n"; printCoords(coords); }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue