-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/sqmedeiros/portugol
- Loading branch information
Showing
13 changed files
with
209 additions
and
37 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bola de gude! |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
local linha = io.read("l") | ||
|
||
local i = 1 | ||
local letra = 0 | ||
while i <= #linha do | ||
local aux = string.sub(linha, i, i) | ||
if aux >= "a" and aux <= "z" then | ||
letra = letra + 1 | ||
end | ||
i = i + 1 | ||
end | ||
|
||
print("Letras = ", letra) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
texto linha | ||
/*inteiro[] letra = novo inteiro[26] | ||
inteiro i = 1 | ||
repita enquanto i <= 26 | ||
letra[i] = 0 | ||
i = i + 1 | ||
fim*/ | ||
|
||
entrada(linha) | ||
|
||
inteiro i = 1 | ||
inteiro letra = 0 | ||
repita enquanto i <= textoComp(linha) | ||
texto aux = textoPos(linha, i) | ||
se aux >= "a" e aux <= "z" | ||
letra = letra + 1 | ||
fim | ||
i = i + 1 | ||
fim | ||
|
||
saida("Letras = ", letra) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
casa | ||
loteria |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
local s1, s2 | ||
|
||
print("Digite uma palava: ") | ||
s1 = io.read("l") | ||
print("Digite outra palavra: ") | ||
s2 = io.read("l") | ||
|
||
local s3 = "" | ||
|
||
local i = 1 | ||
while i <= #s1 and i <= #s2 do | ||
s3 = s3 .. string.sub(s1, i, i) .. string.sub(s2, i, i) | ||
i = i + 1 | ||
end | ||
|
||
while i <= #s1 do | ||
s3 = s3 .. strinng.sub(s1, i, i) | ||
i = i + 1 | ||
end | ||
|
||
while i <= #s2 do | ||
s3 = s3 .. string.sub(s2, i, i) | ||
i = i + 1 | ||
end | ||
|
||
print(s1, s2, s3) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
texto s1, s2 | ||
|
||
saida("Digite uma palava: ") | ||
entrada(s1) | ||
saida("Digite outra palavra: ") | ||
entrada(s2) | ||
|
||
texto s3 = "" | ||
|
||
inteiro i = 1 | ||
repita enquanto i <= textoComp(s1) e i <= textoComp(s2) | ||
s3 = s3 + textoPos(s1, i) + textoPos(s2, i) | ||
i = i + 1 | ||
fim | ||
|
||
repita enquanto i <= textoComp(s1) | ||
s3 = s3 + textoPos(s1, i) | ||
i = i + 1 | ||
fim | ||
|
||
repita enquanto i <= textoComp(s2) | ||
s3 = s3 + textoPos(s2, i) | ||
i = i + 1 | ||
fim | ||
|
||
saida(s1, s2, s3) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
6 | ||
bola | ||
casa | ||
ontem | ||
amanha | ||
hoje | ||
onibus |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
local palavra | ||
local n | ||
|
||
n = io.read("n") | ||
local aux = io.read("l") | ||
|
||
local palavra = {} | ||
local i = 1 | ||
while i <= n do | ||
palavra[i] = io.read("l") | ||
i = i + 1 | ||
end | ||
|
||
i = 2 | ||
while i <= n do | ||
local j = i - 1 | ||
while j >= 1 do | ||
if palavra[j] > palavra[j+1] then | ||
local aux = palavra[j+1] | ||
palavra[j+1] = palavra[j] | ||
palavra[j] = aux | ||
end | ||
j = j - 1 | ||
end | ||
i = i + 1 | ||
end | ||
|
||
i = 1 | ||
while i <= n do | ||
print(palavra[i]) | ||
i = i + 1 | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
texto[] palavra | ||
inteiro n | ||
|
||
entrada(n) | ||
texto aux | ||
entrada(aux) | ||
|
||
palavra = novo texto[n] | ||
inteiro i = 1 | ||
repita enquanto i <= n | ||
entrada(palavra[i]) | ||
i = i + 1 | ||
fim | ||
|
||
i = 2 | ||
repita enquanto i <= n | ||
inteiro j = i - 1 | ||
repita enquanto j >= 1 | ||
se palavra[j] > palavra[j+1] | ||
texto aux = palavra[j+1] | ||
palavra[j+1] = palavra[j] | ||
palavra[j] = aux | ||
fim | ||
j = j - 1 | ||
fim | ||
i = i + 1 | ||
fim | ||
|
||
i = 1 | ||
repita enquanto i <= n | ||
saida(palavra[i]) | ||
i = i + 1 | ||
fim | ||
|