บทที่ 6 1 ฟังก์ชัน printf scanf [slide]
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
2,586
On Slideshare
2,586
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
54
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. กF Printf(); Printf(); Scanf(); Scanf(); ก ก กก
  • 2. ก ก F printf F scanf F F ก F Fprintf scanf ก ก F F stdio.h กF FกF printf scanf F F #include<stdio.h>
  • 3. กF printf() printf()printf() ก F 1. F ก printf( F ); F printf( Hello world ); 2. ก printf( ก , ); F F printf( My age is %dn , myAge);
  • 4. กformat code %d ก (int, short, unsigned short, long, unsigned long %u ก ก (unsigned short, unsigned long %o ก ก %x ก ก ก %f ก (float, double, long double) %e ก ก E ( e) กก (float, double, long double) %c ก ก 1 (char) %s ก F (ก กก F 1 ) %p ก F (pointer)
  • 5. Fmain(){ int i =12345; float x=350.875; printf( %dn ,i); printf( %fn ,x);}
  • 6. F12345350.875000
  • 7. กF scanf(); scanf();Scanf( ) ก F F ก F • กF F C ก ก scanf( ) • F ก keyboard F ก F F F (memory address ) ก ก F function scanf( ) F F F F (address) F F function scanf( )
  • 8. ก F กF scanf(); scanf(); scanf( format string , &variable);1. format string Fก ก ก F2. &variable ( ก F F ก F ) F Fก F F&name
  • 9. F ก F กF scanf(); scanf();F F Fint month ,year;scanf( %d %d , &month, &year); ก ก F Fint i;float x;scanf( %d %f ,&i,&x);
  • 10. F#include<stdio.h>#include<conio.h>int main(){ int year; float salary; clrscr(); printf(“Insert year experience and salary : ”); scanf(“%d %f”,&year,&salary); printf(“You worked for %d years.n”,year); printf(“Your salary is %.2fn”,salary); return(0);}