the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 35 lines 832 B view raw
1#pragma once 2using namespace std; 3 4// 4J Stu - The java formated numbers based on a local passed in, but I am just going for a constant format here 5class NumberFormat 6{ 7public: 8 static wstring format(int value) 9 { 10 // TODO 4J Stu - Change the length of the formatted number 11 wchar_t output[256]; 12 swprintf( output, 256, L"%d", value); 13 wstring result = wstring( output ); 14 return result; 15 } 16}; 17 18 19class DecimalFormat 20{ 21private: 22 const wstring formatString; 23public: 24 wstring format(double value) 25 { 26 // TODO 4J Stu - Change the length of the formatted number 27 wchar_t output[256]; 28 swprintf( output, 256, formatString.c_str(), value); 29 wstring result = wstring( output ); 30 return result; 31 } 32 33 // 4J Stu - The java code took a string format, we take a printf format string 34 DecimalFormat(wstring x) : formatString( x ) {}; 35};