- 【初心者歓迎】C/C++室 Ver.94【環境依存OK】 [転載禁止]©2ch.net
250 :デフォルトの名無しさん[sage]:2014/12/17(水) 10:10:45.50 ID:1UMPa1MZ - >>248
string使えば揃う #include <stdio.h> #include <string> using namespace std; int main() { string str1 = "abc"; string str2 = "abcdef"; string str3 = "ABC"; printf("%-20s:%20.15f,%d\n", str1.c_str(), 12.345, str1.size()); printf("%-20s:%20.15f,%d\n", str2.c_str(), 12.345, str2.size()); printf("%-20s:%20.15f,%d\n", str3.c_str(), 12.345, str3.size()); } /* abc : 12.345000000000001,3 abcdef : 12.345000000000001,6 ABC : 12.345000000000001,6 */
|