Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. ·...
Transcript of Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. ·...
![Page 1: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/1.jpg)
![Page 2: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/2.jpg)
Linguagem C
Funções Padrões
Lógica de Programação
![Page 3: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/3.jpg)
Abs
A função abs retorna o valor inteiro positivo – absoluto.
Sintaxe: int abs (int x);
Prototype: math.h e stdlib.h
![Page 4: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/4.jpg)
Fabs
A função fabs retorna o valor real positivo – absoluto.
Sintaxe: float fabs (float x);
Prototype: math.h e stdlib.h
![Page 5: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/5.jpg)
Asin
A função asin retorna o valor do arco seno. A variável x deve estar em
radianos.
Sintaxe: double asin (double x);
Prototype: math.h
Faixa: -pi / 2 à pi / 2
![Page 6: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/6.jpg)
Acos
A função acos retorna o valor do arco cosseno. A variável x deve estar em
radianos.
Sintaxe: double acos (double x);
Prototype: math.h
Faixa: 0 à pi
![Page 7: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/7.jpg)
Atan
A função atan retorna o valor do arco tangente. A variável x deve estar em
radianos.
Sintaxe: double atan (double x);
Prototype: math.h
Faixa: -pi / 2 à pi / 2
![Page 8: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/8.jpg)
Cos
A função cos retorna o valor do cosseno. A variável x deve estar em
radianos.
Sintaxe: double cos (double x);
Prototype: math.h
Faixa: -1 a1
![Page 9: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/9.jpg)
Sin
A função sin retorna o valor do seno. A variável x deve estar em radianos.
Sintaxe: double sin (double x);
Prototype: math.h
Faixa: -1 a1
![Page 10: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/10.jpg)
Exp
A função exp retorna o valor do
expoente (ex).
Sintaxe: double exp (double x);
Prototype: math.h
![Page 11: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/11.jpg)
Pow
A função pow (power) retorna o valor da potência (xy).
Sintaxe: double pow (double x, double y);
Prototype: math.h
![Page 12: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/12.jpg)
Sqrt
A função sqrt (square root) retorna o valor da raiz quadrada.
Sintaxe: double sqrt (double x);
Prototype: math.h
![Page 13: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/13.jpg)
Log
A função log retorna o valor do logaritmo natural.
Sintaxe: double log (double x);
Prototype: math.h
![Page 14: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/14.jpg)
Atof
A função atof converte string em ponto flutuante.
Sintaxe: double atof (const char *s);
Prototype: math.h e stdlib.h
![Page 15: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/15.jpg)
Atoi
A função atoi converte uma string
em inteiro.
Sintaxe: int atoi (const char *s);
Prototype: stdlib.h
![Page 16: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/16.jpg)
Atol
A função atol converte uma string em inteiro longo.
Sintaxe: long int atol (const char *s);
Prototype: stdlib.h
![Page 17: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/17.jpg)
Log10
A função log10 retorna o logaritmo na base 10.
Sintaxe: double log10 (double x);
Prototype: math.h
![Page 18: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/18.jpg)
Tan
A função tan retorna o valor da tangente. A variável x deve estar em
radianos.
Sintaxe: double tan (double x);
Prototype: math.h
![Page 19: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/19.jpg)
Max
A função max retorna o maior valor entre dois valores.
Sintaxe: int max (int a, int b);
Prototype: stdlib.h
![Page 20: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/20.jpg)
Min
A função min retorna o menor valor entre dois valores.
Sintaxe: int min (int a, int b);
Prototype: stdlib.h
![Page 21: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/21.jpg)
Rand
A função rand retorna um número aleatário entre 0 até 32767.
Sintaxe: int rand (void);
Prototype: stdlib.h
Faixa: 0 a 32767
![Page 22: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/22.jpg)
Random
A função random retorna um número aleatório entre 0 até (limite – 1).
Sintaxe: int random (int limite);
Prototype: stdlib.h
Faixa: 0 a (limite - 1)
![Page 23: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/23.jpg)
Randomize
A função randomize inicializa a geração de números aleatórios.
Sintaxe: void randomize (void);
Prototype: stdlib.h
![Page 24: Linguagem C - IFSuluab.ifsul.edu.br/tsiad/conteudo/modulo1/lop/lop_ug/at4/... · 2012. 6. 12. · Linguagem C Funções Padrões Lógica de Programação. Abs A função abs retorna](https://reader033.fdocument.pub/reader033/viewer/2022053109/607d3de7b3efb1769d206ef1/html5/thumbnails/24.jpg)
System
A função system executa comandos e arquivos .COM e .EXE do sistema operacional.
Sintaxe: int system (const char *comando);
Prototype: process.h e stdlib.h
Retorna: 0 (ok) e -1 (erro)
Exemplos: system ("dir");
system ("sk");
system ("dir *.c");