Flowchartและการเขียนโปรแกรมเบื้องต้นด้วยภาษา...
description
Transcript of Flowchartและการเขียนโปรแกรมเบื้องต้นด้วยภาษา...
-
Flowchart
C
COMPUTER PROGRAMMING350130
-
Computer Programming 2
Flowchart
+ * / %
-
Flowchart
/
( )
/
Computer Programming 3
-
Flowchart (1)
x y x + y
x+y
x, y
x+y
Computer Programming 4
-
Flowchart (2)
x y x y
y=0 Error
y0
x y
x, y
xy
y=0 ?
Error
Computer Programming 5
-
Computer Programming 6
()
Flowchart
-
Computer Programming 7
edit : compile : execute : debug : Integrated programming environment software
edit-compile-execute-debug
-
Computer Programming 8
-
C
(Dennis Ritche)
.. 1972
(Unix Operating System)
Computer Programming 9
-
Computer Programming 10
C
-
Computer Programming 11
-
Computer Programming 12
-
Computer Programming 13
-
Computer Programming 14
( 100%)
;
!!!
-
Computer Programming 15
C
keywords : 48 ( do, while, if, else, switch, ...)
operators : 40 ( +, , *, /, %, +=, ...)
library : ( printf, cos,sort, scanf, getch, getchar, floor,
strcpy, strcmp, .......)
-
Computer Programming 16
(Data Type)
7
: short, int, long
: float, double, long double
: char
( )
array, structure, union, enumerate
-
Computer Programming 17
( ANSI C )
char (1 ), short (2 ), int (2 ), long (4 ),
float (4 ), double (8 ), long double (10 )
( int long)
compiler
:
-
Computer Programming 18
()
1023, 76289, 0, 10, +67392
short (-32678 32767)
int (- 2^(size in bit - 1) 2^(size in bit - 1))
long (-2147483648 214748647)
: unsigned
unsigned int ( 0 - 4294967296 ) CPU 32 bits OS 32 bits
(integer)
-
Computer Programming 19
102.0, 3.14159, 0.0, -10.8, +0.3333
floating point
10000000 0.1x108 , 0.0000012 0.12x10-5
float 6-9
( -3.4x1038 -1.4x10-45 1.4x10-45 3.4x1038)
double 15-17
( -1.8x10308 -4.9x10-324 4.9x10-324 1.8x10308)
(real number)
-
Computer Programming 20
float int
int
float
( )
long 2147483647
float 2147483647
2.14748365 x 109
?
-
Computer Programming 21
char
( ASCII CODE )
(character)
'a', 'b', 'A', 'B', Z', z'
0-9
'1', '2',
'\n' '\t' tab
(character)
-
Computer Programming 22
ASCII Code
-
Computer Programming 23
( ANSI C )
-
Computer Programming 24
(Variable)
-
Computer Programming 25
( )
A ??
grade k
A F
grade k
F F
grade k
-
Computer Programming 26
-
Computer Programming 27
-
Computer Programming 28
;
int count
int counter = 0.75;
char grade = A;
integer counter;
Floating radius = "15.25";
int void;
double char = 3.45;
-
Computer Programming 29
$ _
( function )
int17 butterCup Public int2String day__of__week
7zean I..love..you public ohOH! ed--edd--n--eddy
-
Computer Programming 30
auto double int structbreak else long switchcase enum register typedefchar extern return unionconst float short unsignedcontinue for signed voiddefault goto sizeof volatiledo if static while
-
Computer Programming 31
:
Function :
_ $
--> score
--> color
""
numStudents dayOfWeek imageBuffer
tvChannel customerID initialVelocity
-
comment
// C++ //
/* */ C /* */
system(pause); windows
Computer Programming 32
-
Computer Programming 33
I/O
-
Computer Programming 34
C
printf Function ,,
format
printf(Summation of %d and %d = %d,A,B,C);
%d format integer
A,B,C format
-
Computer Programming 35
printf format
printf(Microcomputer);
format printf
%d %o
%x %u
%e 1.3e5
%f
%g %e %f
%c character 1
%s (string)
-
Computer Programming 36
-
Computer Programming 37
A = 10 , B = 20
#include
void main(void )
{
int A,B;
A = 10; B = 20;
printf(A = %d , B = %d, A, B);
}
*** % %%
-
Computer Programming 38
- () (
) %-10d
%4d 4
. ()
%4.2d 2
4
l () %ld
-
Computer Programming 39
#include
void main(void )
{
printf(:%d:\n,123);
printf(:%2d:\n,123);
printf(:%10d:\n,123);
printf(:%-10d:\n,123);
}
:123:
:123:
: 123:
:123 :
float pi = 3.14592;
printf(" ",pi);
-
Computer Programming 40
printf
\" Double Quotes (")
\' Single Quoat (')
\\ back slash (\)
\nnn ASCII
\041 "!"
\0xnn \f form-feed
\a \n
\b back space \t TAB
\r Carriage return