linguagens de programação introdução
TRANSCRIPT
-
8/20/2019 Linguagens de Programação Introdução
1/50
!"#$%&$'#( *' +,-$,&.&/0-
1',#*- 2&$#- 3%"#40- +','",&
-
8/20/2019 Linguagens de Programação Introdução
2/50
•
5 6%' (0- 7"#$%&$'#( *' 8,-$,&.&/0-9
•
+-, 6%' '7&( ':"(4'.9
•
;-.-
-
8/20/2019 Linguagens de Programação Introdução
3/50
= >-,,' *' ?&@'7
•
A:"(4'. '#4,' BCDDD ' ECDDD7F#$%&( G&7&*&( '. #-((-87'4&C
•
;',
-
8/20/2019 Linguagens de Programação Introdução
4/50
;-.8%4&*-,'( 4&.@K. !"#$%&'()
• ;-.- K & 7"#$%&$'. +(,(-( 8'7-(
-
8/20/2019 Linguagens de Programação Introdução
5/50
O&.-( G&7&, P',-Q%.Q#R(9
•
;-.8%4&*-,'( 8-((%'.
-
8/20/2019 Linguagens de Programação Introdução
6/50
V"&7'4-( *- P',-Q%.Q#R(
•
WL .%"4&( 7"#$%&$'#( *'P',-( ' %#( *"G','#4'(T &((".
-
8/20/2019 Linguagens de Programação Introdução
7/50
./0% 1""2 3' "# 40% 4(1,%5
•
;&*& "#(4,%/0- '. P',-Q%.Q#R( 8-((%" %.#-.'T
-
8/20/2019 Linguagens de Programação Introdução
8/50
2&( #0- K #0-Z
•
=#M$&.'#4' 8,-$,&.&,
-
8/20/2019 Linguagens de Programação Introdução
9/50
A J'"- & V'%(&
•
+&7&J,&( (0- .&"( GL
-
8/20/2019 Linguagens de Programação Introdução
10/50
5 6%' '(4' 8,-$,&.& G&P9
movl $5, %eax
movl $1, %edx
.L4:imull %eax, %edxdecl %eax
testl %eax, $0
jg .L4
-
8/20/2019 Linguagens de Programação Introdução
11/50
5 6%' '(4' 8,-$,&.& G&P9
movl $5, %eax
movl $1, %edx
.L4:imull %eax, %edxdecl %eax
testl %eax, $0
jg .L4
;-7-6%' B '. '&:
;-7-6%' \ '. '*:
2%7M87"6%' '&: 8-, '*: '
-
8/20/2019 Linguagens de Programação Introdução
12/50
5 2-#4&*-,
•
=( 8'((-&( G&7&J&.(''%)1,8 T .&( -(
-
8/20/2019 Linguagens de Programação Introdução
13/50
= V'%(& #0- G-" (%^
-
8/20/2019 Linguagens de Programação Introdução
14/50
•
3%&"( G-,&. &( 8,".'",&( 7"#$%&$'#( *'8,-$,&.&/0-9
• 3%'. G-,&. -( 8&"( *'((&( 7"#$%&$'#(9
-
8/20/2019 Linguagens de Programação Introdução
15/50
-
8/20/2019 Linguagens de Programação Introdução
16/50
A:'.87- *' 8,-$,&.& '. 1-,4,
nfact=1
do i=1, 5nfact = nfact*I
enddo
movl $5, %eaxmovl $1, %edx.L4:
imull %eax, %edxdecl %eax
testl %eax, $0jg .L4
1-,4, =(('.@7c
3%' #-J"*&*'( (%,$",&.
-
8/20/2019 Linguagens de Programação Introdução
17/50
A ]%,$' !X]+
•
\_BdT #'?4;4% "+ /%!0#","@8
•
+,-G'((-, 9"0#
•
e.& #-4&/0- (".87'(T @&('&*& '. G%#/Y'(
.&4'.LM
-
8/20/2019 Linguagens de Programação Introdução
18/50
A:'.87- *' +,-$,&.& '. !X]+
(defun factorial (n)
(if (
-
8/20/2019 Linguagens de Programação Introdução
19/50
=!j5! k %. M.' *' '(4,'7&(
•
+,'&7J'P & .&"( "#n%'#4'7"#$%&$'. *' 8,-$,&.&/0-C
-
8/20/2019 Linguagens de Programação Introdução
20/50
=!j5! k ':'.87-
!"#$%$& (&)*$+,&$ 1&
-
8/20/2019 Linguagens de Programação Introdução
21/50
A ;5?5!
•
;5?5! G-" G'"4& 8&,& #'$t
-
8/20/2019 Linguagens de Programação Introdução
22/50
A:'.87- *' 8,-$,&.&( '. ;5?5!
ADD YEARS TO AGE.
MULTIPLY PRICE BY QUANTITY GIVING COST.
SUBTRACT DISCOUNT FROM COST GIVING
FINAL-COST.
-
8/20/2019 Linguagens de Programação Introdução
23/50
•
3%&( 7"#$%&$'#( *' 8,-$,&.&/0- ':"(4'.9
•
3%&"( &( 7"#$%&$'#( .&"( 8-8%7&,'(9
-
8/20/2019 Linguagens de Programação Introdução
24/50
3%&( (0-9
•
= '*"4-,& 5uh'"77c *"P 6%'':"(4'. HCBDD 7"#$%&$'#(*' 8,-$,&.&/0-
*-
-
8/20/2019 Linguagens de Programação Introdução
25/50
+,-8t("4-( *"G','#4'(
• 1-,4, (',J"& 8&,&
-
8/20/2019 Linguagens de Programação Introdução
26/50
3%&"( (0- &( 7"#$%&$'#( 8-89
•
V&*-( ,'M,&*-( *'www.tiobe.com
– l&J&S \dCf\x
–
;S \ECd_x – +W+S \DC`_x
•
j--$7'
-
8/20/2019 Linguagens de Programação Introdução
27/50
=7$%K. &F G&7& l&JR(9
•
V' &
-
8/20/2019 Linguagens de Programação Introdução
28/50
e. ':'.87- *' s&JR(S
public class Fact {
public static void main(String a[]) {int n = 5;
int fact = 1; while (n > 1) {
fact *= n;
n--;}
System.out.println(fact);}
}
-
8/20/2019 Linguagens de Programação Introdução
29/50
K =T K ?T K 6Z
•
; (%,$"% '. \_fHT ' G-"T *%,' .%"4-(-(T & 7"#$%&$'. *' 8,-$,&.&/0- .&"(8-8%7&,C
•
+-,6%' ; 4'. '(4' #-.'9• 5 6%' & $'#4' G&P
-
8/20/2019 Linguagens de Programação Introdução
30/50
1&7*- '. ;Z
int main() {
int n = 5;int fact = 1;
while (n > 1) {fact *= n;
n--;
}printf("%d\n", fact);
}
•
=7$%K. sL J"% "(4- '(9
-
8/20/2019 Linguagens de Programação Introdução
31/50
; 4'J' $,*' "#n%R#
-
8/20/2019 Linguagens de Programação Introdução
32/50
= X#4',#'4 ,'(8",& +W+
•
=7$%K. &6%" sL 8,-$,&.-% '. +W+9
•
5 6%' '((' #-.' 6%', *"P',9
•
;-.- *'J' (', %.& 7"#$%&$'. 8&,&
*'('#J-7J".'#4- v'@9
-
8/20/2019 Linguagens de Programação Introdução
33/50
e. ':'.87- *' +W+R(S
$id = $_GET[”user”];
if ($id == '') {
echo "Invalid user: $id"} else {
$getuser = $DB->query
(”SELECT * FROM 'table' WHERE id=’$id’”);
echo $getuser;
}
•
=7$%K. #-4-% %. 8-%6%"#I- *' ; &F9
•
3%&7 - M8- *& J&,"LJ'7 $id9
-
8/20/2019 Linguagens de Programação Introdução
34/50
•
;-.8%4&*-,'( G&7&. P',-Q%.Q#R(T #t(G&7&.-( 7"#$%&$'#( *' 8,-$,&.&/0-Z 6%'.4,&*%P '(4&(
-
8/20/2019 Linguagens de Programação Introdução
35/50
;-.8"7&*-,'( (0- 8-#4'(
•
5 8,".'",-
-
8/20/2019 Linguagens de Programação Introdução
36/50
=#&4-."& *' %.
-
8/20/2019 Linguagens de Programação Introdução
37/50
2L6%"#&( O",4%&"(
•
e.& .L6%"#& J",4%&7 K %.0(&-D(&% ".87'.'#4&*- '.'"ED(&%C
•
+-,6%' "((- K "#4','(('9• 3%' 7"#$%&$'#( ':'
-
8/20/2019 Linguagens de Programação Introdução
38/50
z( J'P'(T 4%*- K "#4',8,'4&*-
•
e. "#4',8,'4&*-, #0- 8,-*%P
-
8/20/2019 Linguagens de Programação Introdução
39/50
1&P'.-( F;'4G3#G?)%
•
=7$%.&( 7"#$%&$'#( (0-
-
8/20/2019 Linguagens de Programação Introdução
40/50
•
A:"(4' %.& 7"#$%&$'. *' 8,-$,&.&/0- {.&"(8-*',-(&| 6%' 4-*&( &( -%4,&(9
• ]' ':"(4'T 6%' 7"#$%&$'. K '((&9
•
2&(
-
8/20/2019 Linguagens de Programação Introdução
41/50
1L
-
8/20/2019 Linguagens de Programação Introdução
42/50
WL 6%' (',.-( I%."7*'(
•
= .L6%"#& *' >%,"#$ K %. .-*'7- 4K-,"
-
8/20/2019 Linguagens de Programação Introdução
43/50
!"#$%&$'#( >%,"#$Q;-.87'4&(
•
]' %.& 7"#$%&$'. K '6%"J&7'#4' } 2L6%"#& *'>%,"#$T '#40- '7& K /;&3#@GA")6,%4(C
• 3%&(' 4-*& !+ K >%,"#$Q;-.87'4&C
•
2&( ':"(4'. 7"#$%&$'#( 6%' #0- - (0-C =7$%.':'.87-9
-
8/20/2019 Linguagens de Programação Introdução
44/50
?,&"#QG%
-
8/20/2019 Linguagens de Programação Introdução
45/50
•
A((&( 7"#$%&$'#( 4-*&( 6%' & $'#4' J"%Z l&J&T+W+T ;T 1-,4,T ;5?5!T =7$-7T '4
-
8/20/2019 Linguagens de Programação Introdução
46/50
!"#$%&$'#( X.8',&MJ&( ' V'
-
8/20/2019 Linguagens de Programação Introdução
47/50
]2!
•
5 8,-$,&.& K %.
-
8/20/2019 Linguagens de Programação Introdução
48/50
]-,M#$
fun leq a b = a b
fun filter _ nil = nil
| filter f (h::t) =if f h then h :: filter f t else filter f t
fun qsort nil = nil
| qsort (h::t) =
(qsort (filter (grt h) t))@ [h] @
(qsort (filter (leq h) t))
-
8/20/2019 Linguagens de Programação Introdução
49/50
+,-7-$
•
5 8,-$,&.& K %.
-
8/20/2019 Linguagens de Programação Introdução
50/50
e. 8,-@7'.& ƒ+Q