1 / 9

Introdução a Programação COM 100

Introdução a Programação COM 100. Aula 08 Procedimentos. Program Jurubeba_Tabajara; Var ... ... ... ;. Procedure PROC_1 Begin ... ... ... End;. Procedure PROC_2; Begin ... ... ... End;. Procedure PROC_3; Begin ... ... ... End;. Procedure PROC_4; Begin ... ... ... End;.

palma
Download Presentation

Introdução a Programação COM 100

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introdução a ProgramaçãoCOM 100 Aula 08 Procedimentos

  2. Program Jurubeba_Tabajara;Var ... ... ... ; Procedure PROC_1Begin ... ... ... End; Procedure PROC_2; Begin ... ... ... End; Procedure PROC_3;Begin ... ... ... End; Procedure PROC_4;Begin ... ... ... End; Procedure ImprimeMenu; Begin ... ... End;

  3. BEGIN {Programam Principal} Opcao := ´0´ While (Opcao <> 5) Do Begin ImprimeMenu; realdln(Opcao); Case Opcao Of ´1´ : PROC_1; ´2´ : PROC_2; ´3´ : PROC_3; ´4´ : PROC_4; Else Writeln(´OPÇÃO INVÁLIDA – TECLE ALGO´); OPCAO := Readkey; end; {Case} end; {While} END.

  4. Procedure ImprimeMenu;Begin ClrScr; GoToXY(33, 1); Write(´MENU PRINCIPAL´); GoToXY(28, 6); Write(´1 – Procedimento 1´); GoToXY(28, 8); Write (´2 – Procedimento 2´); GoToXY(28, 10); Write (´3 – Procedimento 3´); GoToXY(28, 12); Write (´4 – Procedimento 4´); GoToXY(28, 14); Write (´5 – Finalizar´); GoToXY(28, 18); Write (´ESCOLHA UMA OPÇÃO´);End;

  5. Rotina Principal A, B Procedimento 1 A, X Procedimento 1.1 W Procedimento 1.2 Y Procedimento 2 M Procedimento 2.1 X

  6. Passagem de Parâmetros – Por Valor Program Bussunda; Procedure Fatorial (N : Integer); Var i, Fat : Integer; Begin Fat := 1; For i := 1 to N Do Fat := Fat * i; Write(Fat); End; Var Nro; Begin Read(Nro); Fatorial (Nro); End.

  7. Passagem de Parâmetros – Por Referência Program Fala_Serio; Procedure Fatorial (N : Integer, Var Fat: integer); Var i : Integer; Begin Fat := 1; For i := 1 to N Do Fat := Fat * i; End; Var Nro, F; Begin Read(Nro); Fatorial (Nro,F); Write(F); End.

  8. Program Ordena_Vetor; Var V : Array[1..10] of Integer; i, j : Integer; Procedure Ordena(Var A, B: Integer); Var X : Integer; BEGIN If (A > B) Then Begin X := A; A := B; B := X; End; END;

  9. BEGIN {Programa Principal} {Leitura do Vetor} For i := 1 To 9 Do {Ordenação do Vetor} For j := i + 1 To 10 Do Ordena(V[ i ], V[ j ]); {Impressão do Vetor Ordenado} END.

More Related