ภาษาซีพื้นฐาน

310 views

Published on

Published in: Education, Technology, Travel
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

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

No notes for slide

ภาษาซีพื้นฐาน

  1. 1. LOGO www.themegallery.com
  2. 2. (Main Menu) File Edit Search Run Compile Debug Project Option Window Help File Edit Search Run
  3. 3. Debu g Proj ect Opti on Wind ow Help Project Directories Compiler
  4. 4. Variable)
  5. 5. Charac Inte Long Integer) Flo
  6. 6. Char Unsigne dchar Int long ASCII character (128 - Float 3.4E-38 E+38 Double 1.7E-308 E+308
  7. 7. C (Variable Declaration) type name; type : name : C main
  8. 8. #include <stdio.h> Int main () { int num; float y; char n; printf("Enter number : ") scanf("%d",&num); printf("Enter name : "); scanf("%f",&n); printf("Thank num y n
  9. 9. A-Z z Underscore) A-Z a-z - a-
  10. 10. Reserved Word) aut def floa regi o ault t ster retu swit do far rn ch got sho type char o rt def uni cons enu str volat brea uct ile k whi doub case le le els signe if e d size unsig conti
  11. 11. C bath_r oom n-sync 108dot s Year# _good goto -
  12. 12. C (char) (string) char name [n] = "str"; nam e n str
  13. 13. char name[5] = "kwan" ; name char year[5] = "2549"; char name kwan year year product_id A01
  14. 14. 1. int a; int b int Com budget = 30000; int Com_budget = 35000; int _count = 451;
  15. 15. void Sue's MAX_ENTRY return double printf time xyz123
  16. 16. C C
  17. 17. - -
  18. 18. b=a++; a++ a b=a; a=a+1; a a a b=++a; a a=a+1; b=a;
  19. 19. a-a b=a--; b=a; a a=a-1; -- b=--a; --a a a=a-1;
  20. 20. a>b a b >== a >= b a b < b <== a<b a a <=
  21. 21. x < 60 && x > 50 x x == 10 || x == 15 x
  22. 22. -- -
  23. 23. 1 . 5 + 2 - 3 -2 2 . 5 / 2 - 3.5 * 2 3 3 .8*1/3 4 . - 5 + 4 * (20 % 6) 5 . (-5 * (192 / 3)
  24. 24. 7 .8 / 3 8 .8 % 1 9 .7 / 2 10 . 3 * 6 / 5 11 . (5 * 4 )% 3 12 . 6 * ( 9 % 4
  25. 25. 1. 2+5 2.13+89 3.2*7-4 4.-34 % 5 5.3 * 7 – ( 6 * 5 / 4 ) + 6 6. x = 15, y = 23 z= 3.75 6.1 x+y/z 6.2 7/2+x 6.3 15 / 2 + 4 * 5 – z
  26. 26. C printf printf int float string
  27. 27. prinft printf ("format",variab format le);
  28. 28. n t r f b
  29. 29. d u f c
  30. 30. printf printf("Hello Program C"); Hello Program C printf("Lampang kunlayanee school"); Lampang kunlayanee school printf printf("Lampang Thailand"); Lampang Thailand x printf("total value = %d",x);
  31. 31. #include <stdio.h> void main() { clrscr(); prinft('Lampang Kunlayanee Schooln"); printf("Program Cn"); getch(); } Lampang Kunlayanee School Program C
  32. 32. scanf() C scanf()
  33. 33. scanf() scanf("format",& variable); format printf() variable
  34. 34. scanf printf float score; float printf("Enter score : "); scanf("%d",&score); score
  35. 35. char answer; char printf("Enter Figure (Y : N) : ") Y N scanf("%c",&answer answer
  36. 36. char name[10]; printf("Enter your name = "); scanf("%s",name) name
  37. 37. #include <stdio.h> void main() { clrscr(); int x,y,sum; printf("Enter The Length is : "); scanf ("%d",&x); printf("Enter The Width is : "); scanf ("%d",&y); sum = x*y; printf("The area is :%d",sum);
  38. 38. 1. int m = 5,n = 8; printf("%d %dn",m%n,n%m); 1) 3) 0 1 5 3 2) 1 0 4) 3 5
  39. 39. int c,k double x,y,z; x = 1.2;y = 2.1; z = 3.2; c = 3; z = x + y + z; k=z/c printf("%f %f %f %d %f",x,y,z,k,z/c); 1)
  40. 40. 3. m n include <stdio.h> void main() { clrscr(); int m,n; printf("Enter 2 integers > "); scanf("%d %d",&m, &n); m = m+5; n = 3*n; printf("m = %dnn= %dn",m,n);
  41. 41. 4. first,second include <stdio.h> void main() { clrscr(); int ……………… , ………... , ………………; printf("Enter ………………………… "); scanf("%d ",&………); printf("Enter ………………………… "); scanf("%d ",&………); printf("Enter third
  42. 42. 5. a include <stdio.h> void main() { clrscr(); int ….. , …….; printf("Enter ………………………… "); scanf("%d ",&………); printf("Enter ………………………… "); scanf("%d ",&………); printf(“a+b,%d ",a+b); b
  43. 43. 6. radius) area) circumference) area = pi * radius * radius circumference = 2 * pi * radius pi
  44. 44.  F) C) C = (F-32)/1.8
  45. 45.  Y X Y=
  46. 46.
  47. 47.  name) birth year)
  48. 48. LOGO www.themegallery.com

×