printf 0100 6012 Computer Programming includestdio h int

  • Slides: 38
Download presentation

ตวอยางการใชงานคำสง printf ทถกตอง 0100 6012 Computer Programming #include<stdio. h> int main() { printf ("Hello

ตวอยางการใชงานคำสง 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 หลายๆคำสง 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

ตวอยางการใชงานคำสง 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

ตวอยางการใชงานคำสง 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 (". . . %? . . .

รายชอตวแปรในคำสง 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

ตวอยางการใชงานคำสง 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

ตวอยางการใชงานคำสง 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

ตวอยางการใชงานคำสง 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 โดยมการกำหนดรปแบบ 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");

ตวอยางการใชงานคำสง 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.

ตวอยางการใชงานคำสง 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. . .

รปแบบคำอธบายโปรแกรม 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

คำถามทายบท 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