Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

airtoncl

Não consigo termina esse exercício no visualG

Recommended Posts

1. represente o recebimento de notas para calculo de uma media. são três notas, cuja média aritmética deve representar a nota final do aluno. restrições: nenhuma das três notas pode ser menor que 0 nem maior que 10. uma mensagem deve ser exibida para cada uma das condições da media alcançada, de acordo coma tabela abaixo:

 

se media <5: "insuficiente".

se media >=5 e media <=6: "regular".

se media > 6 e media <7: "bom".

se media >=7 e media <=8: "ótimo".

se media >8: "excelente".

 

já fiz essa parte toda:

 

var
nota1, nota2, nota3, media:real
inicio
Escreval("digite nota1")
leia(nota1)
Escreval("digite nota2")
leia(nota2)
Escreval("digite nota3")
leia(nota3)
media:=(nota1+nota2+nota3)/3
escreval("sua media foi:", media)
se(media<5)entao
escreval("insuficiente")
senao
se(media>=5)e(media<=6)entao
escreval("regular")
senao
se(media>6)e(media<7)entao
escreval("bom")
senao
se(media>=7)e(media<=8)entao
escreval("otimo")
senao
se(media>8)entao
escreval("excelente")
fimse
fimse
fimse
fimse
fimse
fimalgoritmo
obs: só falta a parde -> nenhuma das três notas pode ser menor que 0 nem maior que 10

Compartilhar este post


Link para o post
Compartilhar em outros sites

1º - passo

trocar isso - se(media<5)entao
por isso - se(media>0)e(media<5)então
2º - passo
trocar isso - se(media>8)entao
por isso - se(media>8)e(media<10)entao
3º - passo
depois do - escreval("excelente")
acrescente - se (media<=0)e(media>=10)escreval("sua nota foi insuficiente")fimse
Não sei o que deve ser feito caso a nota seja <0 ou maior que 10 por isso você escolhe o que fazer mudando o escreval da ultima linha

Compartilhar este post


Link para o post
Compartilhar em outros sites

algoritmo "Media da internet"
// Função : Somar 4 numero e tirar sua media
// Autor : Assis Neto
// Data : 10/09/2015
// Seção de Declarações
var

nota: vetor [1..4] de real
media, aux : real
i: inteiro
x: caracter
inicio

x<-("n") // X <- recebe o caracter (N) como inicial
// caso queira interromper o programa basta quando solicitado escreve s

enquanto x<>("s") faca
para i de 1 ate 4 faca
escreval(" Entre com a Nota :", i)
leia (aux) // AUX, estou utulizando p/ ajudar na implementação
se (aux>= 0) e (aux<= 10) entao // aqui verifico se o valor digitado é diferente de 0
se (nota=0) entao // e se é menor que 10
nota <- aux // ai o vetor NOTA, recebe o valor aonde se encontra a posição
fimse // caso o valor já tenha sido preenchido ele pula o preenchimento
fimse

fimpara

para i de 1 ate 4 faca
escreva (" A Nota",i ," São : ")
escreval (nota)
fimpara
para i de 1 ate 4 faca
media <- media + nota
fimpara
media<- (media/4)
escreval("media é :", media)

se media <5 entao
escreval(" Insuficiente")
fimse
se (media>=5) e (media<=6)entao
escreval(" Regular ")
senao (media>6) entao
escreval(" Tá bom d++++")
fimse

escreval("Para Sair Escreva S ou N P/ Continuar")
leia (x)
fimenquanto

fimalgoritmo

Compartilhar este post


Link para o post
Compartilhar em outros sites

  • Conteúdo Similar

    • Por vinicius_matt
      index
       
       
      <?php
      require_once'CLASSES/usuario.php';
      $u = new usuario;
      ?>
      <!DOCTYPE html>
      <html lang="pt-br">
      <head>
          <meta charset="utf-8"/>
          <title>Lava jato LG</title>
          <link rel="stylesheet" type="text/css" href="CSS/style.css">
          <head>
          </head>
          <body> 
              <div id="corpo-form">
                  <h1>Entrar</h1>
                  <form method="POST">
                      <input type="email" placeholder="Usuário" name="email">
                      <input type="password"  placeholder="Senha" name="senha">
                      <input type="submit" value="Entrar">
                      <a href="cadastrar.php">Ainda náo é inscrito?<strong> Cadastre-se </strong> </a>    
                  </form>    
              </div>
              <?php
              if(isset($_POST['email']))
              {
                  
                  $email = addslashes($_POST['email']);
                  $senha = addslashes($_POST['senha']);
                  }
                  if(!empty($email)&& !empty($senha)) 
                  {
                      $u->conectar("login", "localhost", "root", "");
                      if ($u->msgERRO =="")
                      {
                          if($u->logar($email,$senha))
                          {
                              header("location:areaPrivada.php");
                          }
                          else
                          {
                              echo "Email e/ou senha estão incorretor!!";
                          }
                  }
                  else
                  {
                      echo "ERRO: ".$u->msgERRO;
                  }
              }
              
      ?>
          </body>
          </html>

    • Por flima58
      Segue o código abaixo
      <?php     class LerConteudo{     public $arquivo;     private $linha;          public function getArquivo()     {         $this ->arquivo['arquivo'];      }          public function carregarArquivo()     {               $abrir = fopen($this->arquivo,'r');               if(file_exists($this->$arquivo))          {//Ver se arquivo Existe                       while(!feof($abrir))              {//Ver se chegou fim do arquivo.                          $this->$linha = fgets($abrir);//LINHA recebe o conteudo do arquivo                                         }                        fclose($abrir); // Quando sair do loop, ele irá fechar o arquivo.            }else{                 echo "O arquivo não existe.";//Caso o arquivo não exista.               }              } public function Visualizar() {          echo  $this->$linha;// printando o arquivo atribuido a variavel LINHA          return $this->linha; }            }      $visualizar = Visualizar(); echo $visualizar; ?>  
    • Por Pedro bezerra
      Seguinte, meu site e http://elojobmundo.com/?post_type=product tem um simulador de elos la, quando tento comprar ele redereciona para o carrinho mais o problema e que o produto não vai junto, ele alega que não tem nenhum produto. o que eu preciso fazer? pois tenho o codigo php e quero que va para o carrinho do woocommerce.
      codigo do simulador:
      <center> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript"> function EloEvolution(attrs) { var image_path = 'http://elojob.com.br/calculadora/tier/'; this._products = { b5: { id: 2854, price: 0, image: image_path + 'bronze_5.png' }, b4: { id: 2854, price: 25, image: image_path + 'bronze_4.png' }, b3: { id: 2854, price: 25, image: image_path + 'bronze_3.png' }, b2: { id: 2854, price: 25, image: image_path + 'bronze_2.png' }, b1: { id: 2854, price: 25, image: image_path + 'bronze_1.png' }, s5: { id: 2855, price: 30, image: image_path + 'silver_5.png' }, s4: { id: 2855, price: 30, image: image_path + 'silver_4.png' }, s3: { id: 2855, price: 30, image: image_path + 'silver_3.png' }, s2: { id: 2855, price: 30, image: image_path + 'silver_2.png' }, s1: { id: 2855, price: 30, image: image_path + 'silver_1.png' }, g5: { id: 2856, price: 35, image: image_path + 'gold_5.png' }, g4: { id: 2856, price: 35, image: image_path + 'gold_4.png' }, g3: { id: 2856, price: 35, image: image_path + 'gold_3.png' }, g2: { id: 2856, price: 35, image: image_path + 'gold_2.png' }, g1: { id: 2856, price: 35, image: image_path + 'gold_1.png' }, p5: { id: 2857, price: 50, image: image_path + 'platinum_5.png' }, p4: { id: 2857, price: 50, image: image_path + 'platinum_4.png' }, p3: { id: 2857, price: 50, image: image_path + 'platinum_3.png' }, p2: { id: 2857, price: 50, image: image_path + 'platinum_2.png' }, p1: { id: 2857, price: 50, image: image_path + 'platinum_1.png' }, d5: { id: 2858, price: 100, image: image_path + 'diamond_5.png' }, d4: { id: 2858, price: 120, image: image_path + 'diamond_4.png' }, d3: { id: 2858, price: 100, image: image_path + 'diamond_3.png' }, d2: { id: 2858, price: 100, image: image_path + 'diamond_2.png' }, d1: { id: 2858, price: 100, image: image_path + 'diamond_1.png' }, c5: { id: 2896, price: 200, image: image_path + 'challenger_1-2.png' }, c4: { id: 0, price: 0, image: image_path + 'challenger_1-2.png' }, c3: { id: 0, price: 0, image: image_path + 'challenger_1-2.png' }, c2: { id: 0, price: 0, image: image_path + 'challenger_1-2.png' }, c1: { id: 0, price: 0, image: image_path + 'challenger_1-2.png' } }; this.currencyFormat = 'R$'; this.currencyDecimalSeparator = ','; this._errorMessages = { dest_lt_cur: "Nível Desejado é menor que o Atual" } this._sequence = [ 'b5','b4', 'b3', 'b2', 'b1', 's5','s4', 's3', 's2', 's1', 'g5','g4', 'g3', 'g2', 'g1', 'p5','p4', 'p3', 'p2', 'p1', 'd5','d4', 'd3', 'd2', 'd1', 'c5','c4', 'c3', 'c2', 'c1' ]; this.errors = []; // ============== PUBLIC METHODS ================ // Need to set these settings // this.selectCurrentTier = attrs['selectCurrentTier']; // this.selectCurrentDivision = attrs['selectCurrentDivision']; // this.currentWrapImage = attrs['currentWrapImage']; // this.selectDestinationTier = attrs['selectDestinationTier']; // this.selectDestinationDivision = attrs['selectDestinationDivision']; // this.destinationWrapImage = attrs['destinationWrapImage']; // this.priceContainer = attrs['priceContainer']; // this.addToCartButton = attrs['addToCartButton']; // this.addToCartUrl = attrs['addToCartUrl']; this.settings = function(attrs) { for (var key in attrs) { this[key] = attrs[key]; } this._attachAddToCart(); return this; } this.change = function() { this.ck = $(this.selectCurrentTier).val() + $(this.selectCurrentDivision).val(); this.dk = $(this.selectDestinationTier).val() + $(this.selectDestinationDivision).val(); this.current = this._products[this.ck]; this.destination = this._products[this.dk]; this.updateImage(); var price = this.sumValue(); $(this.priceContainer).text(this._formatCurrency(price)); return this; } this.updateImage = function() { $(this.currentWrapImage).css('background-image', 'url(' + this.current.image + ')'); $(this.destinationWrapImage).css('background-image', 'url(' + this.destination.image + ')'); if($(this.selectDestinationTier).val() == 'c') { $(this.selectDestinationDivision).attr('disabled', 'disabled'); } else { $(this.selectDestinationDivision).removeAttr('disabled'); } } this.sumValue = function() { this._getSequence(); if(this.i_dest < this.i_cur) { this._addError('dest_gt_cur'); return false; } var sum = 0; this._execInSequence(function(p, k){ sum += p.price; }); return sum; } this.addToCart = function() { var evo = this; if(evo.beforeAddToCart) evo.beforeAddToCart(); evo._getSequence(); var products = []; evo._execInSequence(function(p){ products.push(p); }); function ajaxOrRedirectToCart(_products) { var p = products.shift(); if(!p){ window.parent.location = evo.cartUrl; } var url = evo.addToCartUrl.replace('%product_id', p.id); jQuery.get(url).success(function(){ ajaxOrRedirectToCart(_products); }); } ajaxOrRedirectToCart(products); } this.errorMessages = function () { var trErrors = []; for(var i = 0; i < this.errors.length; i++) { var k = this.errors[i]; if(this._errorMessages[k]) { trErrors.push(this._errorMessages[k]); } else { trErrors.push(k); } return trErrors; } } // ============== PRIVATE METHODS ================ this._getSequence = function() { for(var i = 0; i < this._sequence.length; i++) { if(this.ck === this._sequence[i]) { this.i_cur = i; } if(this.dk === this._sequence[i]) { this.i_dest = i; } } } this._execInSequence = function(func) { for(var i = this.i_cur + 1; i <= this.i_dest; i++) { var p_key = this._sequence[i]; var product = this._products[p_key]; func(product, p_key); } } this._formatCurrency = function(val) { var o = []; var decPart = new String(parseInt((val - parseInt(val)) * Math.pow(10, this._currencyDecimalQty)) || 0); var intPart = new String(parseInt(val) || 0); if (decPart < 10) { decPart = "0" + decPart; } o.push(this.currencyFormat); o.push(' ') o.push(intPart); o.push(this.currencyDecimalSeparator); o.push(decPart); return o.join(''); } this._attachAddToCart = function() { var evo = this; jQuery(evo.addToCartButton).click(function(){ evo.addToCart(); }); } this._addError = function(err) { this.errors.push(err); } this.init = function(attrs) { if(attrs) { this.settings(attrs); } } this.init(attrs); } $(function(){ var evo = new EloEvolution({ selectCurrentTier: '#ct', selectCurrentDivision: '#cd', selectDestinationTier: '#dt', selectDestinationDivision: '#dd', currentWrapImage: '#cti', destinationWrapImage: '#dti', priceContainer: '#price', addToCartButton: '#cart', addToCartUrl: '/?post_type=product&add-to-cart=%product_id', cartUrl: '/carrinho', beforeAddToCart: function() { jQuery('#loader').show(); } }).change(); $('#ct,#cd,#dt,#dd').change(function(){ // we need to call inside an anonymous function // because we use `this`, inside evo.change function, // referring to evo instance, instead the dom object // that was changed. evo.change(); }); }); </script> <style> * { -webkit-transition: all 0.4s ease-in-out; -moz-transition: all 0.4s ease-in-out; -o-transition: all 0.4s ease-in-out; transition: all 0.4s ease-in-out; } #content2 { width:725px; background:url('http://elojob.com.br/calculadora/bg_calc.png') no-repeat center top; height:410px; background-size: 100%; } .current_tier_img, .desired_tier_img { width: 192px; height: 192px; background-image: url(http://elojob.com.br/calculadora/tier/bronze_5.png); text-align: center; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; background-repeat: no-repeat; font-size: 18px; position: absolute; left: 50%; top: 70px; ; } #wrapper {position: relative;} .desired_tier_img { ; } .desired_division { background:#FFF; } .current_tier_img span, .desired_tier_img span, #loader, h2 {display: none;} br {clear:both;} /* #loader { width: 100%; height: 100%; display: none; background-color: #fff; opacity: 0.9; position: absolute; text-align: center; vertical-align: middle; padding-top: 300px; }*/ .current_tier_division, .desired_tier_division { width:49%; float:left; margin-bottom:20px; position: relative; } #price { position: absolute; width: 100px; left:50%; text-align: center; font-family: 'Trebuchet Ms'; color:#FFF; ; top: 170px; font-size: 18px; } #cart { width: 150px; height:72px; position: absolute; border: 0px; background:url(http://elojob.com.br/calculadora/bt_comprar.png) no-repeat center top; left: 50%; ; top: 220px; } #cart:hover { cursor: pointer; background:url(http://elojob.com.br/calculadora/bt_comprar2.png) no-repeat center top; } .current_tier, .desired_tier { background:#FFF; position: absolute; top: 250px; left: 50%; ; width: 150px; height: 28px; ; width: 130px; } .current_tier select, .desired_tier select { border:0px; background: none; height: 28px; } .current_tier select:first-child .desired_tier select:first-child { width:100px; } .current_tier select:last-child, .desired_tier select:last-child { float:right; } /*#price { float: right; padding: 5px 10px; width: 83px; text-align: right; border: 1px dotted #d1d1d1; background: #f1f1f1; margin-right: 159px;}*/ </style> <link type="text/css" rel="stylesheet" href="chrome-extension://cpngackimfmofbokmjmljamhdncknpmg/style.css"><script type="text/javascript" charset="utf-8" src="chrome-extension://cpngackimfmofbokmjmljamhdncknpmg/js/page_context.js"></script></head> <body screen_capture_injected="true" cz-shortcut-listen="true"> <div id="loader">Adicionando produto no carrinho...<br>Obs: O tempo de espera depende da quantidade que for adicionado ao carrinho.<br /><img src="http://elojob.com.br/calculadora/ajax-loading.gif" /></div> <div id="content2"> <div id="main_content"> <div id="wrapper"> <div class="current_tier_division"> <div id="cti" class="current_tier_img"><span>Posição Atual</span></div> <div class="current_tier"> <select id="ct"> <option value="b">Bronze</option> <option value="s" selected>Prata</option> <option value="g">Ouro</option> <option value="p">Platina</option> <option value="d">Diamante</option> </select> <select id="cd"> <option>5</option> <option>4</option> <option>3</option> <option>2</option> <option selected>1</option> </select> </div> </div> <div class="desired_tier_division"> <div id="dti" class="desired_tier_img"><span>Posição Desejada</span></div> <div class="desired_tier"> <select id="dt"> <option value="b">Bronze</option> <option value="s">Prata</option> <option value="g" selected>Ouro</option> <option value="p">Platina</option> <option value="d">Diamante</option> <option value="c">Mestre</option> </select> <select id="dd"> <option selected="selected">5</option> <option>4</option> <option>3</option> <option>2</option> <option>1</option> </select> </div> </div> <div id="sv" class="server" style="display:none;"> <select> <option>Brazil</option> </select> </div> <div class="vpn" style="display:none;"> <input name="VPN Protection" type="checkbox" value="VPN Protection" id="vpn_id"></input> </div> <br> <h2> VALOR </h2> <div id="price">Valor</div> <div> <button id="cart"></button> </div> </div> </div> </div> </body> </html> </center>
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.