(cos)
(Windows)
BCLP B
(Bell
Laboratoorics)
The C Programming Language
1988
(Source Program)
c work.c
2. (Compile)
(Build)
(Link)
printf()
.exe
(Header File)
main(
) h.
#include<header_name>
header_name
printf
#include <stdio.h>
(Main Function)
{ }
main( )
2.3
1.
{ } main {}
2.
3. (:)
4. 1 1 1
(identifier)
(address)
:
data_type
var
data
:
var_type
var name
1
,
input
process
output
printf
:
:
String _format
%d
Address_list
& Ampersand
: expreeion
:
var
x
y
Printf “data x = “ scant “%&x :
Printf “data = “ scant “%&y :
2.
R = 2+3 * ;
S= 2+3 * ;
T= 2+3 * - ;
Printf “ r=x+y*2=...
1 (char)
5.1 putchar ( ) 5.2 getchar ( )
5.3 getch ( ) 5.4 getche ( )
5. putcar ( )
1
Putchar_argument
1. ‘A’ char
word1 „1‟ word2
char word1=„A‟ , word2=„1‟
2. 1
putchar(word1); putchar(word2);
A1
5.2 getchar ( )
1
Enter
1
1.
Printf (“Key 1 Character=”) ;
Word = getchar ( ) ;
1 a
Enter
char word
2.
word a ( word)
Printf (“You key Character is ...
1.
printf (“Key 1 Character =” ) ;
word = getch ( ) ;
1
a
Enter
2.
word a ( word)
printf (“Key 1 Character =%cn”,word ) ;
...
5.4 getche ( )
1
Enter
1
2
char_var
1.
printf (“Key 1 Character =” ) ;
word = getcher ( ) ;
1 a
Enter
char word
2.
word a
word)
printf (“Key 1 Character =%cn”...
(String)
char[n]
6.1 puts()
1
string_argument
1.
word
Char word [15] = “*Example*”;
2.
puts
Puts (word) ;
Puts (“*************”);
6.2 gets( )
Enter
1
2
1.
Enter
gets
(word);
2.
printf (You name is = %sn”,word) ;
การเขียนคำสั่งควบคุมขั้นพื้นฐาน
Upcoming SlideShare
Loading in …5
×

การเขียนคำสั่งควบคุมขั้นพื้นฐาน

108 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
108
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

การเขียนคำสั่งควบคุมขั้นพื้นฐาน

  1. 1. (cos) (Windows) BCLP B (Bell Laboratoorics) The C Programming Language 1988
  2. 2. (Source Program) c work.c 2. (Compile) (Build) (Link) printf() .exe
  3. 3. (Header File) main( ) h. #include<header_name> header_name printf #include <stdio.h>
  4. 4. (Main Function) { } main( ) 2.3 1. { } main {} 2. 3. (:) 4. 1 1 1
  5. 5. (identifier) (address)
  6. 6. : data_type var data : var_type var name
  7. 7. 1 ,
  8. 8. input process output printf :
  9. 9. : String _format %d Address_list & Ampersand : expreeion : var
  10. 10. x y Printf “data x = “ scant “%&x : Printf “data = “ scant “%&y : 2. R = 2+3 * ; S= 2+3 * ; T= 2+3 * - ; Printf “ r=x+y*2=%dn”,r : Printf “ r= x+yX*2=5dn”,s : Printf “ r=x+y*2-1 =%dn”,t :
  11. 11. 1 (char) 5.1 putchar ( ) 5.2 getchar ( ) 5.3 getch ( ) 5.4 getche ( ) 5. putcar ( ) 1 Putchar_argument
  12. 12. 1. ‘A’ char word1 „1‟ word2 char word1=„A‟ , word2=„1‟ 2. 1 putchar(word1); putchar(word2); A1 5.2 getchar ( ) 1 Enter 1
  13. 13. 1. Printf (“Key 1 Character=”) ; Word = getchar ( ) ; 1 a Enter char word 2. word a ( word) Printf (“You key Character is =%cn”,word) ; 5.3 getch ( ) 1 Enter 1 2 char_var
  14. 14. 1. printf (“Key 1 Character =” ) ; word = getch ( ) ; 1 a Enter 2. word a ( word) printf (“Key 1 Character =%cn”,word ) ; char word
  15. 15. 5.4 getche ( ) 1 Enter 1 2 char_var
  16. 16. 1. printf (“Key 1 Character =” ) ; word = getcher ( ) ; 1 a Enter char word 2. word a word) printf (“Key 1 Character =%cn”,word ) ;
  17. 17. (String) char[n] 6.1 puts() 1 string_argument
  18. 18. 1. word Char word [15] = “*Example*”; 2. puts Puts (word) ; Puts (“*************”); 6.2 gets( ) Enter 1 2
  19. 19. 1. Enter gets (word); 2. printf (You name is = %sn”,word) ;

×