This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
enum cores{Azul, Branco, Vermelho}; | |
int main() | |
{ | |
// declaração de uma variável enum | |
enum cores cor; | |
// atribui valor Vermelho a variável cor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(int argc, char *argv[]) | |
{ | |
if(argc > 1) | |
{ | |
printf("Argumentos passados:\n"); | |
int i; | |
for(i = 1; i < argc; i++) | |
printf("%s\n", argv[i]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hello World em JavaScript | |
function hello_javascript() { | |
var msg = "Hello www.GeeksBR.com" | |
document.open(); | |
document.write(msg); | |
document.close(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | |
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
<head> | |
<title>Hello GeeksBR!</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<script type="text/javascript" src="helloworld.js"> | |
</script> | |
</head> | |
<body onload="hello_javascript()"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# testado na versão do python 3.2.3 | |
# desempacotamento de lista | |
lista = ["geeks", "br"] | |
nome1, nome2 = lista | |
print(nome1, nome2) | |
# desempacotamento de tupla | |
tupla = (1, 2) | |
num1, num2 = tupla |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# implementation of caesar cipher | |
# key - number of rotational positions | |
def encrypt(text, key): | |
text_list = list(text) | |
text_encrypt = "" | |
for i in text_list: | |
# check if char is a letter | |
if (i >= 'a' and i <= 'z') or (i >= 'A' and i <= 'Z'): | |
if (i >= 'a' and i <= 'z'): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wx | |
my_app = wx.App() | |
frame = wx.Frame(None, -1, "Hello wxPython!") | |
frame.Show() | |
my_app.MainLoop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define MAX 100 | |
// Programa que converte um número decimal para binário | |
void mostrar_binario(int n) | |
{ | |
// casos base: n = 0 ou n = 1 | |
if(n == 0 || n == 1) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
// imprime triângulo de floyd até linha N | |
void mostrar_triangulo(int N) | |
{ | |
if(N < 1) | |
return; | |
int i = 0, qte = 1, num = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define SOMA(x,y) ((x) + (y)) | |
#define SUB(x,y) ((x) - (y)) | |
#define DIV(x,y) ((x) / (y)) | |
#define MULT(x,y) ((x) * (y)) | |
int main() | |
{ | |
printf("Soma: %d\n", SOMA(10, 5)); |
OlderNewer