Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pascal-compiler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lior Spach
pascal-compiler
Commits
1c25aa17
Commit
1c25aa17
authored
9 years ago
by
Lior Spach
Browse files
Options
Downloads
Patches
Plain Diff
Adiciona ArqExemplos.scala
parent
da9cdfc9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/scala/other/ArqExemplos.scala
+94
-0
94 additions, 0 deletions
src/main/scala/other/ArqExemplos.scala
with
94 additions
and
0 deletions
src/main/scala/other/ArqExemplos.scala
0 → 100644
+
94
−
0
View file @
1c25aa17
package
other
object
ArqExemplos
{
val
exemplo5
=
"""program exemplo5 (input, output);
var n, k : integer;
f1, f2, f3 : integer;
begin
read (n);
f1:=0; f2:=1; k:=1;
while k<=n do
begin
f3:=f1+f2;
f1:=f2;
f2:=f3;
k:=k+1
end;
write (n, f1)
end.
"""
val
exemplo8_12
=
"""program exemplo12 (input, output);
var x : integer;
procedure p (var t : integer);
label 100, 200;
var s : integer;
function f(z : integer): integer;
begin
if z<0 then
goto 200
else
if z=0 then
f:=2
else
f:=f(z-2)*z+1
end;
begin
100:
s:=f(t);
t:=s;
if t<x then
goto 100;
200:
x:=x-1
end;
procedure r;
procedure q;
var y : integer;
begin
read (y);
p(y);
write(y)
end;
begin
q
end;
begin
read(x);
r
end."""
val
exemplo8_10
=
"""program exemplo1 (input, output);
var k : integer;
procedure p( n : integer; var g:integer);
var h : integer;
begin
if n<1 then
g:=g+n
else
begin
h:=g;
p(n-1,h);
g:=h;
p(n-2, g)
end;
write(n,g)
end;
begin
k:=0;
p(3,k)
end.
"""
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment