Changes between Version 3 and Version 4 of StringAndNumberLiteralsExample
- Timestamp:
- 05/30/10 22:10:25 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
StringAndNumberLiteralsExample
v3 v4 26 26 */ 27 27 28 const char[]myName = x"4A 75 73 74 69 6E";29 const char[]notRaw = "string\tstring";28 const string myName = x"4A 75 73 74 69 6E"; 29 const string notRaw = "string\tstring"; 30 30 31 31 37 37 */ 38 38 39 const char[]raw1 = r"string\tstring";40 const char[]raw2 = `string\tstring`;41 const char[]raw3 = `apostrophe: ' fancy quote: ` ~ "`";39 const string raw1 = r"string\tstring"; 40 const string raw2 = `string\tstring`; 41 const string raw3 = `apostrophe: ' fancy quote: ` ~ "`"; 42 42 43 43 62 62 { 63 63 /* Print "1000000" */ 64 printf("%i\n", million);64 writef("%i\n", million); 65 65 66 66 /* Print "2" */ 67 printf("%i\n", binTwo);67 writef("%i\n", binTwo); 68 68 69 69 /* Print "16" */ 70 printf("%i\n", hexSixteen);70 writef("%i\n", hexSixteen); 71 71 72 72 /* Print "8" */ 73 printf("%i\n", octEight);73 writef("%i\n", octEight); 74 74 75 75 /* Print "jcc7" */ 76 printf("%.*s\n", myName);76 writef("%s\n", myName); 77 77 78 78 /* Print a string with backslashed characters */ 79 printf("\"Invisible\" backslashed characters: %.*s\n", notRaw);79 writef("\"Invisible\" backslashed characters: %s\n", notRaw); 80 80 81 81 /* Prints a what-you-see-is-what-you-get string */ 82 printf("What-you-see-is-what-you-get [1]: %.*s\n", raw1);82 writef("What-you-see-is-what-you-get [1]: %s\n", raw1); 83 83 84 84 /* Prints a what-you-see-is-what-you-get string */ 85 printf("What-you-see-is-what-you-get [2]: %.*s\n", raw2);85 writef("What-you-see-is-what-you-get [2]: %s\n", raw2); 86 86 87 87 /* Prints a what-you-see-is-what-you-get string */ 88 printf("What-you-see-is-what-you-get [3]: %.*s\n", raw3);88 writef("What-you-see-is-what-you-get [3]: %s\n", raw3); 89 89 90 90 /* Prints one to five */ 91 printf("one-to-five: %.*s\n\n", oneToFive);91 writef("one-to-five: %s\n\n", oneToFive); 92 92 93 printf("This is the first line.93 writef("This is the first line. 94 94 This is the second line. 95 95 I'd say that D is pretty darn cool (third line).