Baixe o app para aproveitar ainda mais
Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original
Program menu_de_programas; var opcao:integer; a,b,c:real; procedure inico; var coluna: integer ; Begin // Desenha um carrinho, que vai andando na tela, até o // usuário pressionar alguma tecla for coluna:= 5 to 50 do Begin clrscr ; textcolor (49); gotoxy( 35, 3 ); writeln( 'LOADING...' ); textcolor (11); gotoxy( coluna, 7 ); writeln( ' - ', #177, #177, #177, #177, #177, #177 ); gotoxy( coluna, 8 ); writeln( '- - ', #177, #177, #177, #177, ' ', #177 ); gotoxy( coluna, 9 ); writeln( '- - ', #177, #177, #177, #177, #177, #177, #177, #177 ); gotoxy( coluna, 10 ); writeln( ' o o' ); gotoxy (4,11); writeln( '--------------------------------------------------------------'); delay( 200 ); if( keypressed ) then break ; End ; End; procedure tela; var col:integer; lin:integer; begin col:=1; lin:=1; while(col<=100)do begin textcolor(11); gotoxy(col,1); writeln(#219); gotoxy(col,5); writeln(#219); gotoxy(col,22); writeln(#219); gotoxy(col,25); writeln(#219); col := col + 1; end; while(lin<=25)do begin gotoxy(1,lin); writeln(#219); gotoxy(80,lin); writeln(#219); lin:=lin+1; end; end; procedure voto; var A,B,C,NULO,BRANCO,votovalido: real; percentA,percentB,percentC: real; percentBranco, percentNulos,percentvotovalido,totaldeeleitores: real; resp:char; Begin resp:='s'; while (resp ='s') do begin clrscr; tela; gotoxy (24,4); writeln (' PROGRAMA APURAÇÃO DE VOTOS'); gotoxy (3,7); writeln('Votos em A:'); gotoxy (3,8); read (A); gotoxy (3,9); writeln('Votos em B:'); gotoxy (3,10); read (B); gotoxy (3,11); writeln('Votos em C:'); gotoxy (3,12); readln (C); gotoxy (3,13); writeln('Votos NULOS:'); gotoxy (3,14); readln (NULO); gotoxy (3,15); writeln('Votos BRANCOS:'); gotoxy (3,16); readln (BRANCO); votovalido:= (A+B+C); totaldeeleitores:= (A+B+C+BRANCO+NULO); percentA:= (A/votovalido)*100; percentB:= (B/votovalido)*100; percentC:= (C/votovalido)*100; percentBranco:= (BRANCO/votovalido)*100; percentNulos:= (NULO/votovalido)*100; percentvotovalido:= (votovalido/totaldeeleitores)*100; clrscr; tela; gotoxy (3,7); writeln ('Votos Válidos=',votovalido); gotoxy (3,8); writeln ('Total de eleitores',totaldeeleitores); gotoxy (3,9); writeln ('Total de votos em A=',A); gotoxy (3,10); writeln ('Total de votos em B=',B); gotoxy (3,11); writeln ('Toral de votos em C=',C); gotoxy (3,12); writeln ('Percentual de votos Válido=',percentvotovalido); gotoxy (3,13); writeln ('Percentual de votos em A=',percentA); gotoxy (3,14); writeln ('Percentual de votos em B=',percentB); gotoxy (3,15); writeln ('Percentual de votos em C=',percentC); gotoxy (3,16); writeln ('Percentual de votos em BRANCO=',percentBranco); gotoxy (3,17); writeln ('Percentual de votos NULOS=',percentNulos); gotoxy (5,23); writeln (' Deseja fazer outra apuração? s/n'); gotoxy (5,24); read (resp); writeln (); End; end; procedure fatorial; var fatorial: integer ; i: integer ; N: Integer; resp: char; Begin resp:='s'; while (resp='s')do begin clrscr; tela; gotoxy (24,3); writeln('PROGRAMA FATORIAL'); gotoxy(3,6); writeln('Informe um Número: '); gotoxy(3,7); readln(N); fatorial:= 1; for i:= 1 to N do begin fatorial:= fatorial * i; end; gotoxy (3,9); writeln('O Valor de ', N, ' Fatorial é: ', fatorial); gotoxy(3,12); writeln('Deseja calcular outro Fatorial? S/N'); readln(resp); end; end; procedure baskara; Var a,b,c : Integer; delta : Real; x1,x2 : Real; resp: char; col: integer; lin: integer; Begin resp := 's'; while (resp ='s') do begin clrscr; tela; GOTOXY(25,3); writeln('EQUAÇÃO DE BHASKARA'); GOTOXY(3,7); Write ('Digite o valor de A:'); GOTOXY (3,8); ReadLn (a); GOTOXY (3,9); Write ('Digite o valor de B:'); GOTOXY (3,10); ReadLn (b); GOTOXY (3,11); Write ('Digite o valor de C:'); GOTOXY (3,12); ReadLn (c); delta := b*b-4*a*c; GOTOXY (3,13); WriteLn ('Delta :',delta:5:2); if delta > 0 then begin x1 := (-b+sqrt(delta))/(2*a); x2 := (-b-sqrt(delta))/(2*a); GOTOXY(3,14); WriteLn ('Duas raizes reais encontradas!'); GOTOXY (3,16); WriteLn ('x1 = ',x1:6:2); GOTOXY (7,17); WriteLn ('x2 = ',x2:6:2); end else if delta < 0 then begin GOTOXY (5,19); WriteLn ('Não há raizes reais!'); end else begin GOTOXY (5,19); WriteLn ('Apenas uma raiz real.'); x1 := (-b)/(2*a); GOTOXY (3,20); WriteLn ('x = ',x1:6:2); end; GOTOXY(3,23); writeln ('Deseja continuar? <s/n>'); GOTOXY(3,24); readln (resp); clrscr; end; end; procedure quadrado; Var A: Integer; ValorA: integer; resp: char; col: integer; lin: integer; Begin resp := 's'; while (resp ='s') do begin clrscr; tela; GOTOXY(25,4); writeln('PROGRAMA QUADRADO'); GOTOXY(7,7); Writeln ('Escolha um Número entre 15 e 200'); GOTOXY(7,9); readln (A); If (A<=200) and (A>=15) then Begin ValorA:= A * A; GOTOXY(7,11); writeln ('O quadrado de ', A, ' é ', ValorA ); end Else Begin GOTOXY (7,15); Writeln ('escolha Número entre 15 e 200'); End; GOTOXY(7,23); writeln ('Deseja continuar? <s/n>'); GOTOXY(32,23); readln (resp); clrscr; end; end; procedure media; var n1, n2, n3, n4, md : real; resp:char; Begin clrscr; resp:='s'; while(resp='s')do begin clrscr; tela; gotoxy (25,3); writeln( 'Calcule da média do aluno'); gotoxy (3,7); writeln( 'Digite o valor da nota 1'); gotoxy (3,8); readln(n1); gotoxy (3,9); writeln( 'Digite o valor da nota 2'); gotoxy (3,10); readln(n2); gotoxy (3,11); writeln( 'Digite o valor da nota 3'); gotoxy (3,12); readln(n3); gotoxy (3,13); writeln( 'Digite o valor da nota 4'); gotoxy (3,14); readln(n4); md := (n1 + n2 + n3 + n4) /4; if (md >59) then begin gotoxy (3,16); writeln( 'aluno aprovado, média:', md) end else gotoxy (3,16); writeln( 'aluno reprovado, média:', md); gotoxy (3,23); writeln('Deseja calcular a média de outro aluno? (S/N)'); gotoxy(3,24); readln(resp); end; end; procedure animais; Var rep: char; Procedure geral; Var resp: char; Begin clrscr; tela; gotoxy (24,4); writeln ('Adivinhando o animal!'); gotoxy (3,6); Writeln ('Responda s/n'); gotoxy (3,7); Writeln ('O animal é um mamífero?'); gotoxy (3,8); readln (resp); if (resp='s') then begin gotoxy (3,9); writeln ('É quadrúpede?'); gotoxy (3,10); readln (resp); if resp='s' then begin gotoxy (3,11); writeln ('É carnívoro?'); gotoxy (3,12); readln (resp); if resp='s' then begin gotoxy (3,13); writeln ('Então o animal é: LEÃO'); end else begin gotoxy (3,13); Writeln ('Então o animal é: CAVALO') end end else begin gotoxy (3,11); Writeln ('É Bípede?'); gotoxy (3,12); readln (resp); if (resp='s') then begin Writeln('É Onívoro?'); readln (resp); If (resp='s') then begin Writeln ('Então o animal é: HOMEM') end else begin Writeln ('Então o animal é: MACACO') end end else begin writeln('É Voador?'); readln(resp); if (resp='s') then begin writeln('Então o animal é: MORCEGO') end else begin writeln('Então o animal é: BALEIA') end end end end else begin writeln('É uma Ave?'); readln(resp); if (resp='s') then begin writeln('É não Voadora?'); readln(resp); if (resp='s') then begin writeln('É Tropical?'); readln(resp); if (resp='s') then begin writeln('Então o animal é: AVESTRUZ') end else begin writeln('Então o animal é: PINGUIM') end end else begin writeln('É Nadadora?'); readln (resp); if (resp='s') then begin writeln('Então o animal é: PATO') end else begin writeln('Então o animal é: ÁGUIA') end end end else begin writeln('Então sabemos que o animal escolhido é um réptil'); writeln('Continue respondendo, estamos perto de descobri-lo'); Writeln('O animal tem Casco?'); readln(resp); if (resp='s') then begin writeln('Então o animal é: TARTARUGA') end else begin writeln('É Carnívoro?'); readln(resp); if (resp='s') then begin writeln ('Tem patas?'); readln (resp); if (resp='s') then begin writeln('Então o animal é: CROCODILO') end else begin writeln('Então o animal é: COBRA') end end end end end End; Begin rep:='s'; while (rep='s') do begin geral; write('Deseja repetir? s/n'); readln(rep); clrscr end; end; procedure salario; var dias,horas,valor,salario:integer; resp:char; Begin clrscr; resp:='s'; while(resp='s') do begin clrscr; tela; gotoxy (24,4); writeln('Cálculo salarial'); gotoxy (3,7); writeln('Quantos dias voce trabalhou?' ); gotoxy (3,8); readln (dias); gotoxy (3,9); writeln('Quantas horas voce trabalhou por dia?'); gotoxy (3,10); readln (horas); gotoxy (3,11); writeln('Qual e o valor de sua hora trabalhada? '); gotoxy (3,12); readln(valor); salario := dias*horas*valor; begin if (salario <= 500) then begin gotoxy (3,14); writeln('seu salario foi de', salario+200, 'reais'); end else if salario > 1000 then begin gotoxy (3,14); writeln('seu salario foi de', salario+50, 'reais') end else gotoxy (3,14); writeln('seu salario foi de', salario+10, 'reais'); end; gotoxy (3,23); writeln('Deseja fazer outro calculo? (S/N)'); gotoxy (3,24); readln(resp); end; end; procedure vetor; var a : array [ 1..5 ] of integer; i , r, soma : integer; resp: char; begin clrscr; resp:='s'; while(resp='s') do begin tela; soma := 0; for i := 1 to 5 do begin gotoxy (25,4); writeln ('Progama somatoria de vetores'); gotoxy (3,7); write ( 'digite um nimero' , i ) ; gotoxy (3,8); readln ( a [ i] ) ; end; for i := 1 to 5 do begin r := a[i] - 2 * (a[i] div 2 ) ; if ( r <> 0 ) then soma := soma + a[i] ; end; gotoxy (5,9); writeln ( ' a soma total e ' , soma ) ; gotoxy (3,23); writeln('Deseja fazer outro calculo? (S/N)'); gotoxy (3,24); readln(resp); clrscr; end; end; procedure calculadora; var a,b,c: real; alter:char; resp:integer; // subrotina de comandos abreviados procedure entrada; begin gotoxy(6,11); writeln ('ENTRE UM VALOR PARA "a":'); gotoxy(6,12); readln (a); gotoxy(6,13); writeln ('ENTRE UM VALOR "b":'); gotoxy(6,14); readln (b); end; procedure escreva; begin gotoxy(9,17); write ('RESULTADO É=',c); END; //subrotina rotadicao procedure rotinasoma ; Begin clrscr; tela; gotoxy(3,9); writeln (' ROTINA SOMA: '); entrada; c:= a+b; escreva; end; procedure rotinasubi; Begin clrscr; tela; gotoxy(3,9); writeln (' ROTINA SUBTRAÇÃO: '); entrada; c:= a-b; gotoxy(9,17); escreva; end; procedure rotinamult; Begin clrscr; tela; gotoxy(3,9); writeln (' ROTINA MULTIPLICAÇÃO: '); entrada; c:= a*b; escreva; end; procedure rotinadivid; Begin clrscr; tela; gotoxy(3,9); writeln (' ROTINA DIVISÃO '); entrada; c:= a/b; escreva; end; // Programa Principal begin resp:=1; while (resp = 1) do begin clrscr; alter:= '0'; tela; gotoxy(19,3); writeln (' PROGRAMA OPERAÇÕES MATEMATICAS '); gotoxy (4,7); writeln (' SELECIONE UMA OPERAÇÃO MATEMATICA!'); gotoxy(6,9); writeln (' 1-Adição'); gotoxy(6,10); writeln (' 2-Subtração'); gotoxy(6,11); writeln (' 3-Multiplicação'); gotoxy(6,12); writeln (' 4-Divisão'); gotoxy(6,13); writeln (' 5-Sair'); gotoxy (6,14); readln ( alter); case alter of '1':rotinasoma; '2':rotinasubi; '3':rotinamult; '4':rotinadivid; end; gotoxy (3,23); writeln (' DESEJA ESCOLHER OUTRA OPERAÇÃO MATEMATICA? (1)SIM (2)NÃO'); gotoxy (3,24); read (resp); writeln (); END; end; procedure tabuad; var x,r,cont:integer; opcao:char; lin:integer; Begin opcao:='s'; while(opcao='s')do begin clrscr; tela; cont:=1; gotoxy (23,4); writeln('Programa tabuada'); gotoxy (4,7); writeln('Qual tabuada deseja estudar?'); gotoxy (4,8); Readln(x); while(cont<11)do begin r:=x*cont; writeln(x,'*',cont,'=',r); cont:=cont+1 end; gotoxy (4,23); writeln('Deseja saber outra tabuada? (s/n)'); gotoxy (4,24); readln(opcao); end; end; procedure parimpar; var x:integer; resp:char; begin clrscr; resp:='s'; while (resp='s') do begin tela; gotoxy (24,4); writeln ('programa par e impar'); gotoxy (3,7); writeln ('digite um número'); gotoxy (3,8); readln (x); gotoxy (4,12); if (x mod 2=0) then writeln ('o número ',x,' é par') else writeln ('o número ',x,'é impar'); gotoxy (3,23); writeln (' deseja escolher outro número s/n'); gotoxy (3,24); readln (resp); clrscr; end; end; begin inico; while(opcao <> 12)do begin clrscr; tela; gotoxy(30,3); writeln('Menu de programas'); gotoxy(3,7); writeln('Escolha a opção:'); gotoxy(3,9); writeln('1 - Voto'); gotoxy(3,10); writeln('2 - Fatorial'); gotoxy(3,11); writeln('3 - Bhaskara'); gotoxy(3,12); writeln('4 - Quadrado'); gotoxy(3,13); writeln('5 - Média'); gotoxy(3,14); writeln('6 - Animais'); gotoxy(3,15); writeln('7 - Salário '); gotoxy(43,7); writeln('8 - Vetor'); gotoxy(43,8); writeln('9 - Calculadora'); gotoxy(43,9); writeln('10 - Tabuada'); gotoxy(43,10); writeln('11 - Par e impar'); gotoxy (43,11); writeln ('12 - Sair'); gotoxy(10,17); readln(opcao); case opcao of 1:voto; 2:fatorial; 3:baskara; 4:quadrado; 5:media; 6:animais; 7:salario; 8:vetor; 9:calculadora; 10:tabuad; 11:parimpar; end; end; end.
Compartilhar