格式化输出
C++:
#include <iostream>
#include <format.hpp>
using namespace std;
int main() {
string str = (boost::format("%2.3f,%d") % 1.23456 % 12).str();
cout << str << endl;
return 0;
}
Java:
public static void main(String[] args){System.out.println(String.format("%2.3f,%d", 1.23456 , 12));
}