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 a[5]; | |
int b; | |
int* c = malloc(10 * sizeof(int)); | |
printf("%i\n", sizeof(a)); | |
printf("%i\n", sizeof(b)); |
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
print(getmetatable(A)) | |
for i, v in pairs(A) do | |
print(i, v) | |
end | |
A.a = "banana" | |
A.subtable.a = "abacate" | |
print(A.a) |
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> | |
#include<stdlib.h> | |
#include<string.h> | |
#include<lua.h> | |
#include<lualib.h> | |
#include<lauxlib.h> | |
int main() |
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
function reverse(tb) | |
local ret = {} | |
for i = #tb, 1, -1 do | |
table.insert(ret, tb[i]) | |
end | |
return ret | |
end | |
--############################################################################## |
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 requests | |
from io import StringIO | |
from lxml import etree | |
URL = "https://observador.pt/seccao/desporto/" | |
def main(): | |
response = requests.get(URL) | |
content = response.text |
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
################################################################################ | |
# mainMenu.py | |
mainMenu = [ | |
'Areas', | |
'Volumes', | |
'Funcoes e, Equacoes (FE)', | |
'Potencias', | |
'Radicais', | |
'Trigonometria', | |
'Geometria', |
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> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Teste de Tirar Foto</title> | |
</head> | |
<body> | |
<div class="camera"> | |
<video id="video" autoplay>Video stream not available.</video> | |
<button id="startbutton">Take photo</button> |
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
# Exemplo de validação de dados numéricos a partir da linha de comando. | |
# Entry Point | |
def main(): | |
while True: | |
print("Entrada inválida. Apenas numeros são aceitos") | |
strNum = input("Digite um numero: ") | |
num = asNumber(strNum) | |
if num != None: | |
break |
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
class Combustivel: | |
def __init__(self, nome, preco, texto): | |
self.nome = nome | |
self.preco = preco | |
self.texto = texto | |
gasolina = Combustivel( | |
nome = "gasolina", | |
preco = 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
num = int(input("Escolha um número decimal para transformar em binario: ")) | |
result = [] | |
while num >= 1: | |
bit = num % 2 | |
result.append(bit) | |
num = int(num/2) | |
# Imprimir em ordem inversa | |
print("".join(map(str, result))[::-1]) |