Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
บทที่ 3
1. 3
C
C
Standard
Output File Standard Input File 3-1
3-1
Standard Input
File Buffered
Standard Output
File
C printf
Printf (“[ ”,[
2. 3–2 Output
Input Output 3 -1
3–1
char - c %c
short int h d %hd
int - d %d
long int I or L d %Ld
float - f %f
double - f %f
long doule L f %Lf
%[
3- 2
3 -2
%d %4d
12 12 12
123 123 123
1234 1234 1234
12345 12345 12345
float
%[
3. printf(“%7.2f”,23.35000);
5 4
1 2
23.35
1. printf(“%d%c%f”,23, „z‟,4.1);
23z4.100000
2. printf(“%d %c %f”, 23. „z‟, 4.1);
23 z 4.100000
1
3. int num1 = 23;
char zee = „z‟;
float num2 = 4.1;
printf(“%d %c %f”, num1, zee, num2);
23 z 4.100000
4. printf(“%dt%ct%5.1f”, 23, „z‟, 14.2);
printf(“%dt%ct%5.1f”, 107, „A‟, 53.6);
printf(“%dt%ct%5.1f”, 1754, „F‟, 122.0);
printf(“%dt%ct%5.1f”, 3, „P‟, 0.1);
23 z 14.2
107 A 53.6
1754 F 122.0
3 P 0.1
5. printf(“The number is %6d”, 23);
4. The number is 23
C
Back-slash character 3-3
3-3 Back-slash character
„0‟ Null Character
„a‟ Alert
„b‟ Backspace
„t‟ Horizontal
„n‟ Newline
„v‟ Vertical tab
„f‟ Form feed
„r‟ Carriage return
„‟ Single quote
„”‟ Double quote
„‟ Backslash
1. printf(“%d %d %dn”, 44, 55);
44 55 0
3 2
2. printf(“%d %dn”, 44, 55, 66);
44 55
2 3 3
3. long int x = 444446766;
printf(“%dn”, x);
-18386
Ld
C scanf