Ir ao conteúdo
  • Cadastre-se

viniciusbmatos

Membros Plenos
  • Total de itens

    655
  • Registro em

  • Última visita

  • Qualificações

    0%

Reputação

3

Sobre viniciusbmatos

  • Data de Nascimento 17-01-1995 (23 anos)

Informações gerais

  • Cidade e Estado
    São Vicente - SP
  1. Seu código com algumas modificações: [color=#0000ff]Program[/color] ex03[color=#000000];[/color] [color=#0000ff]uses[/color] crt[color=#000000];[/color] [color=#0000ff]var[/color] num1[color=#000000],[/color] num2[color=#000000],[/color] quant[color=#000000],[/color] resto[color=#000000],[/color] primos[color=#000000],[/color] dif[color=#000000],[/color] i[color=#000000],[/color] x[color=#000000]:[/color] [color=#000000]integer[/color][color=#000000];[/color] primo[color=#000000]:[/color] [color=#000000]boolean[/color][color=#000000];[/color] [color=#0000ff]begin[/color] num1 [color=#000000]:=[/color] [color=#000000]0[/color][color=#000000];[/color] num2 [color=#000000]:=[/color] [color=#000000]0[/color][color=#000000];[/color] resto [color=#000000]:=[/color] [color=#000000]0[/color][color=#000000];[/color] primos [color=#000000]:=[/color] [color=#000000]0[/color][color=#000000];[/color] dif [color=#000000]:=[/color] [color=#000000]0[/color][color=#000000];[/color] [color=#0000ff]for[/color] i [color=#000000]:=[/color] [color=#000000]2[/color] [color=#0000ff]to[/color] [color=#000000]50[/color] [color=#0000ff]do[/color] [color=#0000ff]begin[/color] quant [color=#000000]:=[/color] [color=#000000]0[/color][color=#000000];[/color] primo [color=#000000]:=[/color] [color=#000000]false[/color][color=#000000];[/color] [color=#0000ff]for[/color] x [color=#000000]:=[/color] i [color=#0000ff]downto[/color] [color=#000000]1[/color] [color=#0000ff]do[/color] [color=#0000ff]if[/color] [color=#000000]([/color]i [color=#0000ff]mod[/color] x [color=#000000]=[/color] [color=#000000]0[/color][color=#000000])[/color] [color=#0000ff]then[/color] [color=#000000]inc[/color][color=#000000]([/color]quant[color=#000000]);[/color] [color=#0000ff]if[/color] [color=#000000]([/color]quant [color=#000000]=[/color] [color=#000000]2[/color][color=#000000])[/color] [color=#0000ff]then[/color] [color=#0000ff]begin[/color] primo [color=#000000]:=[/color] [color=#000000]true[/color][color=#000000];[/color] [color=#000000]inc[/color][color=#000000]([/color]primos[color=#000000]);[/color] [color=#0000ff]end[/color][color=#000000];[/color] [color=#0000ff]if[/color] [color=#000000]([/color]primos [color=#000000]=[/color] [color=#000000]6[/color][color=#000000])[/color] [color=#0000ff]and[/color] primo [color=#0000ff]then[/color] [color=#0000ff]begin[/color] num1 [color=#000000]:=[/color] i[color=#000000];[/color] [color=#000000]writeln[/color][color=#000000]([/color][color=#800000]'sexto numero primo = '[/color][color=#000000],[/color] num1[color=#000000]);[/color] [color=#0000ff]end[/color] [color=#0000ff]else[/color] [color=#0000ff]if[/color] [color=#000000]([/color]primos [color=#000000]=[/color] [color=#000000]12[/color][color=#000000])[/color] [color=#0000ff]and[/color] primo [color=#0000ff]then[/color] [color=#0000ff]begin[/color] num2 [color=#000000]:=[/color] i[color=#000000];[/color] [color=#000000]writeln[/color][color=#000000]([/color][color=#800000]'decimo segundo numero primo = '[/color][color=#000000],[/color] num2[color=#000000]);[/color] [color=#0000ff]end[/color][color=#000000];[/color] [color=#0000ff]end[/color][color=#000000];[/color] dif [color=#000000]:=[/color] num2 [color=#000000]-[/color] num1[color=#000000];[/color] [color=#000000]writeln[/color][color=#000000]([/color][color=#800000]'a diferenca entre os dois numeros e: '[/color][color=#000000],[/color] dif[color=#000000]);[/color] readkey[color=#000000];[/color] [color=#0000ff]end[/color][color=#000000].[/color] Obs.: o for "ao contrário" é com downto, não to.
  2. Poste os códigos que já fez e quais foram as dúvidas...
  3. Para converter de km para m, multiplique o valor da variável por 1000. Para converter de m para km, multiplique o valor da variável por 0.001. Exemplo: [color=#3b6ac8]program[/color] conv[color=#323232];[/color] [color=#3b6ac8]uses[/color] crt[color=#323232];[/color] [color=#3b6ac8]var[/color] dist[color=#323232]:[/color] [color=#a00050]real[/color][color=#323232];[/color] opc[color=#323232]:[/color] [color=#a00050]char[/color][color=#323232];[/color] [color=#3b6ac8]begin[/color] [color=#c73a69]writeln[/color][color=#323232]([/color][color=#1094a0]'Digite uma medida em METROS ou QUILÔMETROS:'[/color][color=#323232]);[/color] [color=#c73a69]readln[/color][color=#323232]([/color]dist[color=#323232]);[/color] [color=#00a150]while[/color] keypressed [color=#00a150]do[/color] readkey[color=#323232];[/color] [color=#969696]//limpar entrada[/color] [color=#c73a69]writeln[/color][color=#323232]([/color][color=#1094a0]'Pressione A se a distância está em metros ou B se está em quilômetros:'[/color][color=#323232]);[/color] [color=#00a150]repeat[/color] opc [color=#323232]:=[/color] [color=#c73a69]upcase[/color][color=#323232]([/color]readkey[color=#323232]);[/color] [color=#00a150]until[/color] opc [color=#3b6ac8]in[/color] [color=#323232][[/color][color=#1094a0]'A'[/color][color=#323232],[/color] [color=#1094a0]'B'[/color][color=#323232]];[/color] [color=#3b6ac8]case[/color] opc [color=#3b6ac8]of[/color] [color=#1094a0]'A'[/color][color=#323232]:[/color] [color=#c73a69]writeln[/color][color=#323232]([/color]dist[color=#323232]:[/color][color=#1094a0]0[/color][color=#323232]:[/color][color=#1094a0]2[/color][color=#323232],[/color] [color=#1094a0]' m = '[/color][color=#323232], ([/color]dist[color=#323232]*[/color][color=#1094a0]0.001[/color][color=#323232]):[/color][color=#1094a0]0[/color][color=#323232]:[/color][color=#1094a0]2[/color][color=#323232],[/color] [color=#1094a0]' km'[/color][color=#323232]);[/color] [color=#1094a0]'B'[/color][color=#323232]:[/color] [color=#c73a69]writeln[/color][color=#323232]([/color]dist[color=#323232]:[/color][color=#1094a0]0[/color][color=#323232]:[/color][color=#1094a0]2[/color][color=#323232],[/color] [color=#1094a0]' km = '[/color][color=#323232], ([/color]dist[color=#323232]*[/color][color=#1094a0]1000[/color][color=#323232]):[/color][color=#1094a0]0[/color][color=#323232]:[/color][color=#1094a0]2[/color][color=#323232],[/color] [color=#1094a0]' m'[/color][color=#323232]);[/color] [color=#3b6ac8]end[/color][color=#323232];[/color] readkey[color=#323232];[/color] [color=#3b6ac8]end[/color][color=#323232].[/color]
  4. Apenas postando o link do colega Will702 corrigido: http://www.4shared.com/file/qoDk8hC3/Classificao_de_IP_2.html
  5. Veja se isto ajuda: http://delphi.about.com/od/windowsshellapi/a/executeprogram.htm
  6. Não precisa usar o XP Mode. Pode ser uma máquina virtual "comum" no VirtualBox, VMware ou VirtualPC.
  7. Poste o que já fez e quais são suas dúvidas. Armazenar a "linha" (uma string) em um array de char: isso já é feito ao ler uma string, mas você pode ler letra por letra. Ler um par de caracteres: Basta usar o readkey duas vezes. Procurar o par no array: se não quiser usar a função POS, com um for é possível percorrer a string e verificar se o par foi encontrado.
  8. Como será a entrada? Como deverá ser a saída? O que já conseguiu fazer? (Poste o código...) Quais são suas dúvidas?
  9. Fiz algumas alterações: [color=#69c73a]#include <conio.h>[/color] [color=#a00050]int[/color] [color=#c73a69]soma[/color][color=#323232]([/color][color=#a00050]int[/color] n1[color=#323232],[/color][color=#a00050]int[/color] n2[color=#323232])[/color] [color=#323232]{[/color] [color=#3b6ac8]return[/color] n1[color=#323232]+[/color]n2[color=#323232];[/color] [color=#323232]}[/color] [color=#a00050]int[/color] [color=#c73a69]subtracao[/color][color=#323232]([/color][color=#a00050]int[/color] n1[color=#323232],[/color][color=#a00050]int[/color] n2[color=#323232])[/color] [color=#323232]{[/color] [color=#3b6ac8]return[/color] n1[color=#323232]-[/color]n2[color=#323232];[/color] [color=#323232]}[/color] [color=#a00050]int[/color] [color=#c73a69]multiplicacao[/color][color=#323232]([/color][color=#a00050]int[/color] n1[color=#323232],[/color][color=#a00050]int[/color] n2[color=#323232])[/color] [color=#323232]{[/color] [color=#3b6ac8]return[/color] n1[color=#323232]*[/color]n2[color=#323232];[/color] [color=#323232]}[/color] [color=#a00050]int[/color] [color=#c73a69]divisao[/color][color=#323232]([/color][color=#a00050]int[/color] n1[color=#323232],[/color][color=#a00050]int[/color] n2[color=#323232])[/color] [color=#323232]{[/color] [color=#3b6ac8]return[/color] n1[color=#323232]/[/color]n2[color=#323232];[/color] [color=#323232]}[/color] [color=#a00050]int[/color] [color=#c73a69]main[/color][color=#323232]([/color][color=#a00050]void[/color][color=#323232])[/color] [color=#323232]{[/color] [color=#a00050]int[/color] i[color=#323232],[/color]n1[color=#323232],[/color]n2[color=#323232],[/color]resultado[color=#323232][[/color][color=#1094a0]3[/color][color=#323232]];[/color] [color=#a00050]char[/color] continuar[color=#323232],[/color]operador[color=#323232];[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]"Ol%c! Deseja utilizar a calculadora %c (Y/N)[/color][color=#dc6816]\n[/color][color=#1094a0]"[/color][color=#323232],[/color][color=#1094a0]160[/color][color=#323232],[/color][color=#1094a0]63[/color][color=#323232]);[/color] [color=#3b6ac8]do[/color] continuar[color=#323232]=[/color][color=#c73a69]getch[/color][color=#323232]();[/color] [color=#3b6ac8]while[/color][color=#323232](([/color]continuar[color=#323232]-[/color][color=#1094a0]'y'[/color][color=#323232])*([/color]continuar[color=#323232]-[/color][color=#1094a0]'Y'[/color][color=#323232])*([/color]continuar[color=#323232]-[/color][color=#1094a0]'N'[/color][color=#323232])*([/color]continuar[color=#323232]-[/color][color=#1094a0]'n'[/color][color=#323232]));[/color] [color=#3b6ac8]while[/color][color=#323232](!(([/color]continuar[color=#323232]-[/color][color=#1094a0]'Y'[/color][color=#323232])*([/color]continuar[color=#323232]-[/color][color=#1094a0]'y'[/color][color=#323232])))[/color] [color=#323232]{[/color] [color=#3b6ac8]for[/color][color=#323232]([/color]i[color=#323232]=[/color][color=#1094a0]0[/color][color=#323232];[/color] i[color=#323232]<=[/color][color=#1094a0]2[/color][color=#323232];[/color] i[color=#323232]++)[/color] [color=#323232]{[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]"[/color][color=#dc6816]\n[/color][color=#1094a0]Entre com dois numeros inteiros :[/color][color=#dc6816]\n[/color][color=#1094a0]"[/color][color=#323232]);[/color] [color=#c73a69]scanf[/color][color=#323232]([/color][color=#1094a0]"%d %d"[/color][color=#323232],&[/color]n1[color=#323232],&[/color]n2[color=#323232]);[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]"[/color][color=#dc6816]\n[/color][color=#1094a0]Entre com um operador (+,-,/,*) :[/color][color=#dc6816]\n[/color][color=#1094a0]"[/color][color=#323232]);[/color] [color=#3b6ac8]do[/color] operador[color=#323232]=[/color][color=#c73a69]getch[/color][color=#323232]();[/color] [color=#3b6ac8]while[/color][color=#323232](([/color]operador[color=#323232]-[/color][color=#1094a0]'*'[/color][color=#323232])*([/color]operador[color=#323232]-[/color][color=#1094a0]'x'[/color][color=#323232])*([/color]operador[color=#323232]-[/color][color=#1094a0]'X'[/color][color=#323232])*([/color]operador[color=#323232]-[/color][color=#1094a0]'/'[/color][color=#323232])*([/color]operador[color=#323232]-[/color][color=#1094a0]'+'[/color][color=#323232])*([/color]operador[color=#323232]-[/color][color=#1094a0]'-'[/color][color=#323232]));[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]"%c"[/color][color=#323232],[/color]operador[color=#323232]);[/color] [color=#3b6ac8]switch[/color][color=#323232]([/color]operador[color=#323232])[/color] [color=#323232]{[/color] [color=#3b6ac8]case[/color] [color=#1094a0]'+'[/color][color=#323232]:[/color] resultado[color=#323232][[/color]i[color=#323232]]=[/color][color=#c73a69]soma[/color][color=#323232]([/color]n1[color=#323232],[/color]n2[color=#323232]);[/color] [color=#3b6ac8]break[/color][color=#323232];[/color] [color=#3b6ac8]case[/color] [color=#1094a0]'-'[/color][color=#323232]:[/color] resultado[color=#323232][[/color]i[color=#323232]]=[/color][color=#c73a69]subtracao[/color][color=#323232]([/color]n1[color=#323232],[/color]n2[color=#323232]);[/color] [color=#3b6ac8]break[/color][color=#323232];[/color] [color=#3b6ac8]case[/color] [color=#1094a0]'X'[/color][color=#323232]:[/color] [color=#3b6ac8]case[/color] [color=#1094a0]'x'[/color][color=#323232]:[/color] [color=#3b6ac8]case[/color] [color=#1094a0]'*'[/color][color=#323232]:[/color] resultado[color=#323232][[/color]i[color=#323232]]=[/color][color=#c73a69]multiplicacao[/color][color=#323232]([/color]n1[color=#323232],[/color]n2[color=#323232]);[/color] [color=#3b6ac8]break[/color][color=#323232];[/color] [color=#3b6ac8]case[/color] [color=#1094a0]'/'[/color][color=#323232]:[/color] resultado[color=#323232][[/color]i[color=#323232]]=[/color][color=#c73a69]divisao[/color][color=#323232]([/color]n1[color=#323232],[/color]n2[color=#323232]);[/color] [color=#3b6ac8]break[/color][color=#323232];[/color] [color=#323232]}[/color] [color=#323232]}[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]"[/color][color=#dc6816]\n\n\n[/color][color=#1094a0]=========R E S U L T A D O=========[/color][color=#dc6816]\n[/color][color=#1094a0]"[/color][color=#323232]);[/color] [color=#3b6ac8]for[/color][color=#323232]([/color]i[color=#323232]=[/color][color=#1094a0]0[/color][color=#323232];[/color] i[color=#323232]<[/color][color=#1094a0]3[/color][color=#323232];[/color] i[color=#323232]++)[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]" %5d "[/color][color=#323232],[/color]resultado[color=#323232][[/color]i[color=#323232]]);[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]"[/color][color=#dc6816]\n\n[/color][color=#1094a0]Deseja continuar?[/color][color=#dc6816]\n[/color][color=#1094a0]"[/color][color=#323232]);[/color] [color=#3b6ac8]do[/color] continuar[color=#323232]=[/color][color=#c73a69]getch[/color][color=#323232]();[/color] [color=#3b6ac8]while[/color][color=#323232](([/color]continuar[color=#323232]-[/color][color=#1094a0]'y'[/color][color=#323232])*([/color]continuar[color=#323232]-[/color][color=#1094a0]'Y'[/color][color=#323232])*([/color]continuar[color=#323232]-[/color][color=#1094a0]'N'[/color][color=#323232])*([/color]continuar[color=#323232]-[/color][color=#1094a0]'n'[/color][color=#323232]));[/color] [color=#323232]}[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]"Volte quando precisar !"[/color][color=#323232]);[/color] [color=#c73a69]getch[/color][color=#323232]();[/color] [color=#3b6ac8]return[/color] [color=#1094a0]0[/color][color=#323232];[/color] [color=#323232]}[/color] [color=#69c73a]#include <stdio.h>[/color] Ou ainda menor: [color=#69c73a]#include <conio.h>[/color] [color=#a00050]int[/color] [color=#c73a69]main[/color][color=#323232]([/color][color=#a00050]void[/color][color=#323232])[/color] [color=#323232]{[/color] [color=#a00050]int[/color] i[color=#323232],[/color]n1[color=#323232],[/color]n2[color=#323232],[/color]resultado[color=#323232][[/color][color=#1094a0]3[/color][color=#323232]];[/color] [color=#a00050]char[/color] continuar[color=#323232],[/color]operador[color=#323232];[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]"Ol%c! Deseja utilizar a calculadora %c (Y/N)[/color][color=#dc6816]\n[/color][color=#1094a0]"[/color][color=#323232],[/color][color=#1094a0]160[/color][color=#323232],[/color][color=#1094a0]63[/color][color=#323232]);[/color] [color=#3b6ac8]do[/color] continuar[color=#323232]=[/color][color=#c73a69]getch[/color][color=#323232]();[/color] [color=#3b6ac8]while[/color][color=#323232](([/color]continuar[color=#323232]-[/color][color=#1094a0]'y'[/color][color=#323232])*([/color]continuar[color=#323232]-[/color][color=#1094a0]'Y'[/color][color=#323232])*([/color]continuar[color=#323232]-[/color][color=#1094a0]'N'[/color][color=#323232])*([/color]continuar[color=#323232]-[/color][color=#1094a0]'n'[/color][color=#323232]));[/color] [color=#3b6ac8]while[/color][color=#323232](!(([/color]continuar[color=#323232]-[/color][color=#1094a0]'Y'[/color][color=#323232])*([/color]continuar[color=#323232]-[/color][color=#1094a0]'y'[/color][color=#323232])))[/color] [color=#323232]{[/color] [color=#3b6ac8]for[/color][color=#323232]([/color]i[color=#323232]=[/color][color=#1094a0]0[/color][color=#323232];[/color] i[color=#323232]<=[/color][color=#1094a0]2[/color][color=#323232];[/color] i[color=#323232]++)[/color] [color=#323232]{[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]"[/color][color=#dc6816]\n[/color][color=#1094a0]Entre com dois numeros inteiros :[/color][color=#dc6816]\n[/color][color=#1094a0]"[/color][color=#323232]);[/color] [color=#c73a69]scanf[/color][color=#323232]([/color][color=#1094a0]"%d %d"[/color][color=#323232],&[/color]n1[color=#323232],&[/color]n2[color=#323232]);[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]"[/color][color=#dc6816]\n[/color][color=#1094a0]Entre com um operador (+,-,/,*) :[/color][color=#dc6816]\n[/color][color=#1094a0]"[/color][color=#323232]);[/color] [color=#3b6ac8]do[/color] operador[color=#323232]=[/color][color=#c73a69]getch[/color][color=#323232]();[/color] [color=#3b6ac8]while[/color][color=#323232](([/color]operador[color=#323232]-[/color][color=#1094a0]'*'[/color][color=#323232])*([/color]operador[color=#323232]-[/color][color=#1094a0]'x'[/color][color=#323232])*([/color]operador[color=#323232]-[/color][color=#1094a0]'X'[/color][color=#323232])*([/color]operador[color=#323232]-[/color][color=#1094a0]'/'[/color][color=#323232])*([/color]operador[color=#323232]-[/color][color=#1094a0]'+'[/color][color=#323232])*([/color]operador[color=#323232]-[/color][color=#1094a0]'-'[/color][color=#323232]));[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]"%c"[/color][color=#323232],[/color]operador[color=#323232]);[/color] [color=#3b6ac8]switch[/color][color=#323232]([/color]operador[color=#323232])[/color] [color=#323232]{[/color] [color=#3b6ac8]case[/color] [color=#1094a0]'+'[/color][color=#323232]:[/color] resultado[color=#323232][[/color]i[color=#323232]]=[/color]n1[color=#323232]+[/color]n2[color=#323232];[/color] [color=#3b6ac8]break[/color][color=#323232];[/color] [color=#3b6ac8]case[/color] [color=#1094a0]'-'[/color][color=#323232]:[/color] resultado[color=#323232][[/color]i[color=#323232]]=[/color]n1[color=#323232]-[/color]n2[color=#323232];[/color] [color=#3b6ac8]break[/color][color=#323232];[/color] [color=#3b6ac8]case[/color] [color=#1094a0]'X'[/color][color=#323232]:[/color] [color=#3b6ac8]case[/color] [color=#1094a0]'x'[/color][color=#323232]:[/color] [color=#3b6ac8]case[/color] [color=#1094a0]'*'[/color][color=#323232]:[/color] resultado[color=#323232][[/color]i[color=#323232]]=[/color]n1[color=#323232]*[/color]n2[color=#323232];[/color] [color=#3b6ac8]break[/color][color=#323232];[/color] [color=#3b6ac8]case[/color] [color=#1094a0]'/'[/color][color=#323232]:[/color] resultado[color=#323232][[/color]i[color=#323232]]=[/color]n1[color=#323232]/[/color]n2[color=#323232];[/color] [color=#3b6ac8]break[/color][color=#323232];[/color] [color=#323232]}[/color] [color=#323232]}[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]"[/color][color=#dc6816]\n\n\n[/color][color=#1094a0]=========R E S U L T A D O=========[/color][color=#dc6816]\n[/color][color=#1094a0]"[/color][color=#323232]);[/color] [color=#3b6ac8]for[/color][color=#323232]([/color]i[color=#323232]=[/color][color=#1094a0]0[/color][color=#323232];[/color] i[color=#323232]<[/color][color=#1094a0]3[/color][color=#323232];[/color] i[color=#323232]++)[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]" %5d "[/color][color=#323232],[/color]resultado[color=#323232][[/color]i[color=#323232]]);[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]"[/color][color=#dc6816]\n\n[/color][color=#1094a0]Deseja continuar?[/color][color=#dc6816]\n[/color][color=#1094a0]"[/color][color=#323232]);[/color] [color=#3b6ac8]do[/color] continuar[color=#323232]=[/color][color=#c73a69]getch[/color][color=#323232]();[/color] [color=#3b6ac8]while[/color][color=#323232](([/color]continuar[color=#323232]-[/color][color=#1094a0]'y'[/color][color=#323232])*([/color]continuar[color=#323232]-[/color][color=#1094a0]'Y'[/color][color=#323232])*([/color]continuar[color=#323232]-[/color][color=#1094a0]'N'[/color][color=#323232])*([/color]continuar[color=#323232]-[/color][color=#1094a0]'n'[/color][color=#323232]));[/color] [color=#323232]}[/color] [color=#c73a69]printf[/color][color=#323232]([/color][color=#1094a0]"Volte quando precisar !"[/color][color=#323232]);[/color] [color=#c73a69]getch[/color][color=#323232]();[/color] [color=#3b6ac8]return[/color] [color=#1094a0]0[/color][color=#323232];[/color] [color=#323232]}[/color] [color=#69c73a]#include <stdio.h>[/color] Obs.: o programa funciona apenas com números inteiros, isto é, 7/2=3 e 1/3=0.
  10. Se o que falta é capturar automaticamente alterações na área de transferência, veja o link do meu post anterior.
  11. Você pode utilizar o Windows 7 e instalar o XP em uma máquina virtual (que fica em tela cheia e não tem delay) para usar o Turbo Pascal e o Delphi 5. O Delphi 5 é muito antigo, foi lançado em 1999. Então, é muito provável que alguns códigos da bíblia do Delphi 5 funcionem só até o Windows 98.
  12. [color=#000000][b]uses[/b][/color] crt[color=#a52a2a][b];[/b][/color] [color=#4682b4][i]//sem ela não funciona o "clrscr"[/i][/color] [color=#4682b4][i]//aqui fica a declaração de variáveis globais quando necessário[/i][/color] [color=#000000][b]procedure[/b][/color] menu_outros[color=#a52a2a][b];[/b][/color] [color=#000000][b]var[/b][/color] opcao_outros[color=#a52a2a][b]:[/b][/color] [color=#0000cd][b]byte[/b][/color][color=#a52a2a][b];[/b][/color] [color=#4682b4][i]//é necessário declarar todas as variáveis utilizadas[/i][/color] [color=#000000][b]begin[/b][/color] clrscr[color=#a52a2a][b];[/b][/color] [color=#4682b4][i]//limpar a tela[/i][/color] [color=#228b22]writeln[/color][color=#a52a2a][b]([/b][/color][color=#ff4500]'1 - Opcao 1'[/color][color=#a52a2a][b]);[/b][/color] [color=#228b22]writeln[/color][color=#a52a2a][b]([/b][/color][color=#ff4500]'2 - Opcao 2'[/color][color=#a52a2a][b]);[/b][/color] [color=#228b22]writeln[/color][color=#a52a2a][b]([/b][/color][color=#ff4500]'Digite a opcao: '[/color][color=#a52a2a][b]);[/b][/color] [color=#4682b4][i]//estava faltando abrir a aspa[/i][/color] [color=#228b22]read[/color][color=#a52a2a][b]([/b][/color]opcao_outros[color=#a52a2a][b]);[/b][/color] [color=#4682b4][i]//não se coloca ";" antes do parâmetro[/i][/color] [color=#000000][b]end[/b][/color][color=#a52a2a][b];[/b][/color] [color=#4682b4][i]//estava faltando o "end"[/i][/color] [color=#000000][b]procedure[/b][/color] opcao_1[color=#a52a2a][b];[/b][/color] [color=#000000][b]begin[/b][/color] clrscr[color=#a52a2a][b];[/b][/color] [color=#228b22]writeln[/color][color=#a52a2a][b]([/b][/color][color=#ff4500]'voce Esta na Opcao 1'[/color][color=#a52a2a][b]);[/b][/color] [color=#4682b4][i]//faltava fechar a aspa[/i][/color] readkey[color=#a52a2a][b];[/b][/color] [color=#4682b4][i]//readln só continuará se o usuário pressionar Enter[/i][/color] [color=#4682b4][i]//readkey espera qualquer tecla ser pressionada[/i][/color] [color=#000000][b]end[/b][/color][color=#a52a2a][b];[/b][/color] [color=#000000][b]procedure[/b][/color] opcao_2[color=#a52a2a][b];[/b][/color] [color=#000000][b]begin[/b][/color] clrscr[color=#a52a2a][b];[/b][/color] [color=#228b22]writeln[/color][color=#a52a2a][b]([/b][/color][color=#ff4500]'voce Esta na Opcao 2'[/color][color=#a52a2a][b]);[/b][/color] [color=#4682b4][i]//faltava fechar a aspa e estava escrito "Opcao 1"[/i][/color] readkey[color=#a52a2a][b];[/b][/color] [color=#4682b4][i]//veja acima[/i][/color] [color=#000000][b]end[/b][/color][color=#a52a2a][b];[/b][/color] [color=#000000][b]function[/b][/color] menu_inicial[color=#a52a2a][b]:[/b][/color] [color=#0000cd][b]byte[/b][/color][color=#a52a2a][b];[/b][/color] [color=#4682b4][i]//trocando procedure por function, para poder retornar valor[/i][/color] [color=#000000][b]var[/b][/color] opcao[color=#a52a2a][b]:[/b][/color] [color=#0000cd][b]byte[/b][/color][color=#a52a2a][b];[/b][/color] [color=#4682b4][i]//é necessário declarar todas as variáveis utilizadas[/i][/color] [color=#000000][b]begin[/b][/color] [color=#4682b4][i]//faltava o "begin"[/i][/color] [color=#228b22]writeln[/color][color=#a52a2a][b]([/b][/color][color=#ff4500]'1 - Opcao 1'[/color][color=#a52a2a][b]);[/b][/color] [color=#228b22]writeln[/color][color=#a52a2a][b]([/b][/color][color=#ff4500]'2 - Opcao 2'[/color][color=#a52a2a][b]);[/b][/color] [color=#228b22]writeln[/color][color=#a52a2a][b]([/b][/color][color=#ff4500]'3 - Menu Outros'[/color][color=#a52a2a][b]);[/b][/color] [color=#4682b4][i]//faltava fechar a aspa[/i][/color] [color=#228b22]writeln[/color][color=#a52a2a][b]([/b][/color][color=#ff4500]'4 - SAIR'[/color][color=#a52a2a][b]);[/b][/color] [color=#4682b4][i]//adicionada opção para sair[/i][/color] [color=#228b22]write[/color][color=#a52a2a][b]([/b][/color][color=#ff4500]'Escolha Uma Opcao '[/color][color=#a52a2a][b]);[/b][/color] [color=#4682b4][i]// Ecolha -> Escolha[/i][/color] [color=#228b22]readln[/color][color=#a52a2a][b]([/b][/color]opcao[color=#a52a2a][b]);[/b][/color] [color=#4682b4][i]//trocando ifs por case[/i][/color] [color=#000000][b]case[/b][/color] opcao [color=#000000][b]of[/b][/color] [color=#000000]1[/color][color=#a52a2a][b]:[/b][/color] opcao_1[color=#a52a2a][b];[/b][/color] [color=#000000]2[/color][color=#a52a2a][b]:[/b][/color] opcao_2[color=#a52a2a][b];[/b][/color] [color=#000000]3[/color][color=#a52a2a][b]:[/b][/color] menu_outros[color=#a52a2a][b];[/b][/color] [color=#000000]4[/color][color=#a52a2a][b]:[/b][/color] [color=#000000][b]begin[/b][/color] [color=#228b22]writeln[/color][color=#a52a2a][b]([/b][/color][color=#ff4500]'SAINDO...'[/color][color=#a52a2a][b]);[/b][/color] [color=#228b22]delay[/color][color=#a52a2a][b]([/b][/color][color=#000000]2500[/color][color=#a52a2a][b]);[/b][/color] [color=#000000][b]end[/b][/color][color=#a52a2a][b];[/b][/color] [color=#228b22]else[/color] [color=#228b22]writeln[/color][color=#a52a2a][b]([/b][/color][color=#ff4500]'OPCAO INVALIDA'[/color][color=#a52a2a][b]);[/b][/color] [color=#4682b4][i]//é obrigatório delimitar uma string com aspas simples[/i][/color] [color=#000000][b]end[/b][/color][color=#a52a2a][b];[/b][/color] result [color=#a52a2a][b]:=[/b][/color] opcao[color=#a52a2a][b];[/b][/color] [color=#4682b4][i]//retornando o valor[/i][/color] [color=#4682b4][i]//é desnecessário esperar alguma tecla aqui[/i][/color] [color=#000000][b]end[/b][/color][color=#a52a2a][b];[/b][/color] [color=#4682b4][i]//faltava o "end"[/i][/color] [color=#4682b4][i]//aqui fica a declaração de variáveis não-globais do programa principal quando necessário[/i][/color] [color=#4682b4][i]//é necessário o código do programa principal![/i][/color] [color=#4682b4][i]{main}[/i][/color] [color=#000000][b]begin[/b][/color] [color=#228b22]writeln[/color][color=#a52a2a][b]([/b][/color][color=#ff4500]'Menu Principal'[/color][color=#a52a2a][b]);[/b][/color] [color=#228b22]while[/color] menu_inicial [color=#a52a2a][b]<>[/b][/color] [color=#000000]4[/color] [color=#228b22]do[/color] [color=#000000][b]begin[/b][/color] clrscr[color=#a52a2a][b];[/b][/color] [color=#228b22]writeln[/color][color=#a52a2a][b]([/b][/color][color=#ff4500]'Voltando ao Menu Principal...'[/color][color=#a52a2a][b]);[/b][/color] [color=#228b22]while[/color] keypressed [color=#228b22]do[/color] readkey[color=#a52a2a][b];[/b][/color] [color=#000000][b]end[/b][/color][color=#a52a2a][b];[/b][/color] [color=#000000][b]end[/b][/color][color=#a52a2a][b].[/b][/color]

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas publicações sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×