3C                                                          C                                                          Sta...
3–2                   Output                           Input           Output       3 -1        3–1               char    ...
printf(“%7.2f”,23.35000);                                        5                   4          1                         ...
The number is         23        C                                  Back-slash character       3-3            3-3     Back-...
Scanf(“[               ”,[                        3-3                                            Enter                    ...
234                  (Input)                                 0                      (Output)                              ...
ch = getchar(0;        3-1              “Nothing”                   3-1               “Nothing”                  3-2
3-2
Upcoming SlideShare
Loading in …5
×

บทที่ 3

309 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
309
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

บทที่ 3

  1. 1. 3C C Standard Output File Standard Input File 3-1 3-1 Standard InputFile BufferedStandard OutputFile C printfPrintf (“[ ”,[
  2. 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 12123 123 1231234 1234 123412345 12345 12345 float%[
  3. 3. printf(“%7.2f”,23.35000); 5 4 1 2 23.351. printf(“%d%c%f”,23, „z‟,4.1); 23z4.1000002. printf(“%d %c %f”, 23. „z‟, 4.1); 23 z 4.100000 13. int num1 = 23;char zee = „z‟;float num2 = 4.1;printf(“%d %c %f”, num1, zee, num2); 23 z 4.1000004. 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.15. printf(“The number is %6d”, 23);
  4. 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 „‟ Backslash1. printf(“%d %d %dn”, 44, 55);44 55 0 3 22. printf(“%d %dn”, 44, 55, 66);44 55 2 3 33. long int x = 444446766;printf(“%dn”, x);-18386 Ld C scanf
  5. 5. Scanf(“[ ”,[ 3-3 Enter Error1. 214 156 14zscanf(“%d%d%d%c”, &a, &b, &c, %d); 14 z c scanf(“%d%d%d %c”, &a, &b, &c, %d);2. 2314 15 2.14scanf(“%d %d %f”, &a, &b, &c);3. 14/26 25/66scanf(“%2d/%2d %2d/%2d”, &num1, &num2, &num3, &num4);4. 11-25-56scanf(“%d-%d-%d”,&a, &b, &c);1. int a = 0;scanf(“%d”,a);printf(“%d/n”,a);
  6. 6. 234 (Input) 0 (Output) & a error2. float a = 2.1;scanf(“%5.2f”,&a);printf(“%5.2f”,a);3. int a;Int b;scanf(“%d%d%d”,&a, &b);Printf(“%d %d/n”, a, b);5 10 (Input) 5 10 (Output) 3 2 scanf 2 3 conio.hgetch 1 Enter ch = getch();getche getchch = getch();getchar 1 Enter
  7. 7. ch = getchar(0; 3-1 “Nothing” 3-1 “Nothing” 3-2
  8. 8. 3-2

×