printf 0100 6012 Computer Programming includestdio h int
- Slides: 38
ตวอยางการใชงานคำสง printf ทถกตอง 0100 6012 Computer Programming #include<stdio. h> int main() { printf ("Hello World!"); return 0; } Hello World! 13
ตวอยางการใชงานคำสง printf หลายๆคำสง 0100 6012 Computer Programming #include<stdio. h> #include<conio. h> int main() { printf ("Hello World!"); printf ("This is my first Program. "); printf ("I am a programmer. "); return 0; } Hello World!This is my first Program. I am a programmer. 16
ตวอยางการใชงานคำสง printf โดยใชคารหส ASCII 0100 6012 Computer Programming #include<stdio. h> int main() { printf ("Hello World!n"); printf ("This is my first Program. "); printf ("nt. I'm a programmer. "); return 0; } Hello World! This is my first Program. I'm a programmer. 18
ตวอยางการใชงานคำสง printf แสดงผลขอมล 0100 6012 Computer Programming #include<stdio. h> int main() { printf ("My name is : %sn", "Kmitl"); printf ("My point : %dn", 10+40+49); printf ("Grade : %cn", 'A'); printf ("GPA : %f", 3. 99); return 0; } My name is : Kmitl My point : 99 Grade : A GPA : 3. 990000 21
รายชอตวแปรในคำสง printf 0100 6012 Computer Programming printf (". . . %? . . . ", data); ตวอยาง . . . data. . . printf (". . . %d. . . ", 19); . . . 19. . . printf ("%? %? . . . %? ", data-1, data-2, . . . , data-n); ตวอยาง data-1 data-2. . . data-n printf ("%d-%d-%d", 19, 1, 1980); 19 -1 -1980 23
ตวอยางการใชงานคำสง printf แสดงผลขอมลหลายตว -1 0100 6012 Computer Programming #include<stdio. h> int main() { printf ("Age = %d, GPA = %fn", 17, 3. 75); printf ("Programming: %fn. Mechanics: %f", 4. 0, 3. 5); return 0; } Age = 17, GPA = 3. 750000 Programming: 4. 000000 Mechanics: 3. 5000000 24
ตวอยางการใชงานคำสง printf แสดงผลขอมลหลายตว -2 0100 6012 Computer Programming #include<stdio. h> int main() { printf ("Subject : %s(%d)n", "Programming", 2552); printf ("Point : %dn. Grade : %c", 99, 'A'); return 0; } Subject : Programming(2552) Point : 99 Grade : A 25
ตวอยางการใชงานคำสง printf โดยมการกำหนดรปแบบ 1 0100 6012 Computer Programming #include<stdio. h> int main() { printf ("12345678901234567890"); printf ("n%20 d*", 46); printf ("n%-20 d*", 46); printf ("n%3 d*", 2550); return 0; } 12345678901234567890 46* 46* 2550* 27
ตวอยางการใชงานคำสง printf โดยมการกำหนดรปแบบ 2 0100 6012 Computer Programming #include <stdio. h> int main() { printf ("12345678901234567890"); printf ("n%20 c*", 'c'); printf ("n%-20 c*", 'c'); printf ("n%10 s*", "Pro"); printf ("n%10 s*", "Programming"); return 0; } 12345678901234567890 c* c * Programming* 28
ตวอยางการใชงานคำสง printf โดยมการกำหนดรปแบบ 3 0100 6012 Computer Programming printf printf ("12345678901234567890"); ("n%20 s*", "programming"); ("n%-20 s*", "programming"); ("n%. 3 s*", "programming"); ("n%20. 3 s*", "programming"); ("n%-20. 3 s*", "programming"); 12345678901234567890 programming* programming * pro* pro *_ 30
ตวอยางการใชงานคำสง printf โดยมการกำหนดรปแบบ 4 0100 6012 Computer Programming printf printf ("12345678901234567890"); ("n%20 f*", 1234. 56789); ("n%-20 f*", 1234. 56789); ("n%. 3 f*", 1234. 56789); ("n%20. 3 f*", 1234. 56789); ("n%-20. 3 f*", 1234. 56789); 12345678901234567890 1234. 567890* 1234. 567890 * 1234. 568* 1234. 568 *_ 31
รปแบบคำอธบายโปรแกรม 0100 6012 Computer Programming /* Comment Sentence 1 Comment Sentence 2. . . Comment Sentence n */ /* Comment Sentence */ // Comment Sentence 33
คำถามทายบท 1. แสดงผลของโปรแกรมตอไปน 0100 6012 Computer Programming #include<stdio. h> int main() { /* float radius, pi, area; pi = 22/7; // pi = 3. 14; printf ("Enter Radius of Circular : "); scanf ("%f", &radius); area = pi * radius; */ printf (“Programming Language”, 2008); return 0; } 37
- Int sum(int a int n) int sum=0 i
- Int max(int x int y)
- Inheritance calculator
- Public void drawsquare(int x, int y, int len)
- Public int divide(int a int b)
- #includestdio.h
- Num = num + 1
- Me 6012
- Windows 6012
- Perulangan looping
- Interface myinterface int foo(int x)
- Int main int argc char argv
- Nnxn com
- 7팩토리얼
- Const int arduino
- Int main int num 4
- Voidswap
- Int f (int n)
- Int.max
- Include
- #includestdio.h
- #includeconio.h
- Din vde 0100 gruppe 700 liste
- 0011 0011 1011 0001 0010 1000 0101
- Perbedaan linear programming dan integer programming
- Greedy vs dynamic
- Windows 10 system programming, part 1
- Linear vs integer programming
- Definisi integer
- Printf 陣列
- C printf wrapper
- Haskell printf
- C++ scanf
- System.out.printf
- Printf format string vulnerability
- Num=printf( 2 )
- Float x='a' printf( f x)