前田稔(Maeda Minoru)の超初心者のプログラム入門
![]()
![]()
Console.WriteLine("編集の形式(ZZZZ9) {0,5}", 3);
Console.WriteLine("編集の形式(ZZZZ9) {0,5}", 12);
Console.WriteLine("編集の形式(ZZZZ9) {0,5}", 123);
|
編集の形式(ZZZZ9) 3 編集の形式(ZZZZ9) 12 編集の形式(ZZZZ9) 123 |
/***************************************/
/*★ DATA を編集して印字 前田 稔 ★*/
/***************************************/
using System;
class Prog
{
public static void Main()
{
int i = 123;
int j = 123456789;
int k = 255;
float a = 1234.56F;
double b = 10000000000;
double c = 1234567890.789;
float d = 0.9876F;
Console.WriteLine("i = {0}", i);
Console.WriteLine("i = {0,5}", i);
Console.WriteLine("i = {0,-5}", i);
Console.WriteLine("i = {0:d}", i);
Console.WriteLine("i = {0:d5}", i);
Console.WriteLine("jx = {0:x} jX= {0:X8}", j, j);
Console.WriteLine("k = {0:x}", k);
Console.WriteLine("i = {0:c}", i);
Console.WriteLine("j = {0:n}", j);
Console.WriteLine();
Console.WriteLine("i = {0:0000.00}", i);
Console.WriteLine("i = {0:####.##}", i);
Console.WriteLine("j = {0:(###)####-####}", j);
Console.WriteLine("j = {0:(000)0000-0000}", j);
Console.WriteLine();
Console.WriteLine("a = {0}", a);
Console.WriteLine("a = {0:c}", a);
Console.WriteLine("a = {0:c4}", a);
Console.WriteLine("a = {0:.0000}", a);
Console.WriteLine("a = {0:####.#}", a);
Console.WriteLine();
Console.WriteLine("b = {0}", b);
Console.WriteLine("b = {0:e2}", b);
Console.WriteLine("b = {0:e5}", b);
Console.WriteLine("b = {0:0,0}", b);
Console.WriteLine("b = {0:0,0,}", b);
Console.WriteLine("b = {0:0,0,,}", b);
Console.WriteLine("b = {0:0,0,,,}", b);
Console.WriteLine("b = {0:#,#}", b);
Console.WriteLine();
Console.WriteLine("c = {0}", c);
Console.WriteLine("c = {0:f}", c);
Console.WriteLine("c = {0:f5}", c);
Console.WriteLine("c = {0:e}", c);
Console.WriteLine("c = {0:0.0e+000000}", c);
Console.WriteLine("c = {0:g}", c);
Console.WriteLine("c = {0:g7}", c);
Console.WriteLine("c = {0:g8}", c);
Console.WriteLine();
Console.WriteLine("d = {0}", d);
Console.WriteLine("d = {0:p2}", d);
Console.WriteLine("d = {0:p4}", d);
Console.WriteLine();
}
}
|
i = 123 i = 123 i = 123 i = 123 i = 00123 jx = 75bcd15 jX= 075BCD15 k = ff i = \123 j = 123,456,789.00 i = 0123.00 i = 123 j = (1)2345-6789 j = (001)2345-6789 a = 1234.56 a = \1,235 a = \1,234.5600 a = 1234.5600 a = 1234.6 b = 10000000000 b = 1.00e+010 b = 1.00000e+010 b = 10,000,000,000 b = 10,000,000 b = 10,000 b = 10 b = 10,000,000,000 c = 1234567890.789 c = 1234567890.79 c = 1234567890.78900 c = 1.234568e+009 c = 1.2e+000009 c = 1234567890.789 c = 1.234568e+09 c = 1.2345679e+09 d = 0.9876 d = 98.76% d = 98.7600% |
![]()
int i = 123;
int j = 123456789;
int k = 255;
float a = 1234.56;
double b = 10000000000;
double c = 1234567890.789;
float d = 0.9876;
|
<B>編集記号 編集結果</B>
"i = {0}" "i = 123"
"i = {0,5}" "i = 123"
"i = {0,-5}" "i = 123 "
"i = {0:d}" "i = 123"
"i = {0:d5}" "i = 00123"
"jx = {0:x} jX= {0:X8}" "jx = 75bcd15 jX= 075BCD15"
"k = {0:x}" "k = ff"
"i = {0:c}" "i = \123"
"j = {0:n}" "j = 123,456,789.00"
"i = {0:0000.00}" "i = 0123.00"
"i = {0:####.##}" "i = 123"
"j = {0:(###)####-####}" "j = (1)2345-6789"
"j = {0:(000)0000-0000}" "j = (001)2345-6789"
"a = {0}" "a = 1234.56"
"a = {0:c}" "a = \1,235"
"a = {0:c4}" "a = \1,234.5600"
"a = {0:.0000}" "a = 1234.5600"
"a = {0:####.#}" "a = 1234.6"
"b = {0}" "b = 10000000000"
"b = {0:e2}" "b = 1.00e+010"
"b = {0:e5}" "b = 1.00000e+010"
"b = {0:0,0}" "b = 10,000,000,000"
"b = {0:0,0,}" "b = 10,000,000"
"b = {0:0,0,,}" "b = 10,000"
"b = {0:0,0,,,}" "b = 10"
"b = {0:#,#}" "b = 10,000,000,000"
"c = {0}" "c = 1234567890.789"
"c = {0:f}" "c = 1234567890.79"
"c = {0:f5}" "c = 1234567890.78900"
"c = {0:e}" "c = 1.234568e+009"
"c = {0:0.0e+000000}" "c = 1.2e+000009"
"c = {0:g}" "c = 1234567890.789"
"c = {0:g7}" "c = 1.234568e+09"
"c = {0:g8}" "c = 1.2345679e+09"
"d = {0}" "d = 0.9876"
"d = {0:p2}" "d = 98.76%"
"d = {0:p4}" "d = 98.7600%"
|
![]()