https://dl.dropboxusercontent.com/u/15987859/aluno_ifrn.tar.gz
This file contains hidden or 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 MaiorMenor | |
def initialize() | |
@numero = rand(100) + 1 | |
@fim_de_jogo = false | |
end | |
def palpite(valor) | |
if valor < @numero then | |
resposta = "O numero eh maior do que #{valor}: " | |
elsif valor > @numero then |
This file contains hidden or 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"><link rel="stylesheet" href="potigol.css"><head> | |
<body><button onclick="javascript:window.print();">Print this page</button> | |
<pre><span class="comentario"></span>x<span class='atribuicao'> = </span>10 | |
<span class="comentario"># Valor fixo | |
</span><span class='chave'>var </span>y<span class='atribuicao'> := </span>10 | |
<span class="comentario"># Valor alterável | |
</span>y<span class='atribuicao'> := </span>y <span class='operador'>+</span> 2 |
This file contains hidden or 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
f(x: Inteiro): Inteiro = escolha x | |
caso 0 => 1 | |
caso n => n * f(n - 1) | |
fim | |
solução = | |
para x de 0 até 10 se f(x + 3) + f(x + 2) == 8 * f(x + 1) gere x fim | |
escreva solução |
This file contains hidden or 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
program XX | |
use crt; | |
print("wqwwq") |
This file contains hidden or 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
# Programa CPF | |
verifica_digito(cpf: Lista[Inteiro]) | |
var soma = 0 | |
tam = cpf.tamanho | |
para i de 2 até tam + 1 faça | |
soma := soma + i * cpf[tam + 2 - i] | |
fim | |
resto = soma mod 11 | |
se resto < 2 então 0 senão 11 - resto fim |
This file contains hidden or 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
$n = M1+M2 | |
def f(a) | |
n = $n + (a * 2) | |
$n = $n+1 | |
return n | |
end | |
def g(a) | |
$n = $n + a + 1 | |
x = $n*2 | |
return x |
This file contains hidden or 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
def fc(x,y) | |
s=0 | |
a = x.split(“”) | |
for i in a do | |
if (y==a[i]) then | |
s = s + 1 | |
end | |
end | |
return s | |
end |
This file contains hidden or 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
// Importar os métodos de StdIn (readInt, readLine, ...) | |
import scala.io.StdIn._ | |
// Variáveis (o tipo é inferido a partir do valor atribuído) | |
val x = 10 // Constante (é a forma preferível) | |
val x: Int = 10 // | |
var y = 20 | |
y = y + 10 | |
// Entrada de dados |
This file contains hidden or 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
/* | |
* Funcionário usando classe | |
*/ | |
trait Pessoa { | |
def nome: String | |
} | |
class Funcionario(val nome: String, _salario: Double) extends Pessoa { | |
def salario = _salario |