#include <iostream>
#include <vector>
#include <random>
#include <algorithm>

typedef std::vector<std::vector<int>> vec2;

vec2 MakeData01(int W, int H){
	vec2 vec{
		{ 1, 5, 3, 4, },
		{ 0, 4, 1, 0, },
		{ 7, 2, 3, 1, },
};

	return vec;
}

vec2 MakeData02(int W, int H){
	vec2 vec;
	std::random_device rd;
	std::mt19937_64 mt(rd()*rd());//手抜き
	std::uniform_int_distribution<int> uid(0, 999);

	for (int i = 0; i < H; i++){
		vec.push_back(std::vector<int>());
		for (int j = 0; j < W; j++)
		{
			vec[i].push_back(uid(mt));
		}
	}

	return vec;
}

bool BubbleSortV(vec2& vec, std::size_t P){
	for (std::size_t i = 0; i < vec.size(); i++){
		for (std::size_t j= i; j < vec.size(); j++){
			if (vec[i][P]>vec[j][P])std::swap(vec[i][P], vec[j][P]);
		}
	}
	return true;
}

bool MakeHoge(vec2& Vec){
	for (auto& o : Vec) std::sort(o.begin(), o.end());
	for (std::size_t i = 0; i < Vec[0].size(); i++) BubbleSortV(Vec, i);

	return true;
}

bool Show(vec2 vec){
	std::cout << "Result;"<<std::endl;
	for (auto& oo : vec){
		for (auto& o : oo){
			std::cout << o << ',';
		}
		std::cout <<std::endl;
	}
	std::cout <<std::endl;
	return true;
}

int main(){
	vec2 D;

	D = MakeData01(4, 3);
	MakeHoge(D);
	Show(D);
	D = MakeData02(4, 3);
	MakeHoge(D);
	Show(D);
	D = MakeData02(16, 15);
	MakeHoge(D);
	Show(D);
	return 0;

}