Ir para conteúdo
  • ×   Você colou conteúdo com formatação.   Remover formatação

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

  • Conteúdo Similar

    • Por ILR master
      Fala galera.
      Espero que todos estejam bem.
      Seguinte: Tenho um arquivo xml onde alguns campos estão com : (dois pontos), como o exemplo abaixo:
       
      <item>
      <title>
      d sa dsad sad sadasdas
      </title>
      <link>
      dsadas dsa sad asd as dsada
      </link>
      <pubDate>sadasdasdsa as</pubDate>
      <dc:creator>
      d sad sad sa ad as das
      </dc:creator>
      </item>
       
      Meu código:
       
      $link = "noticias.xml"; 
      $xml = simplexml_load_file($link); 
      foreach($xml -> channel as $ite) {     
           $titulo = $ite -> item->title;
           $urltitulo = $ite -> item->link;
           print $urltitulo = $ite -> item->dc:creator;
      } //fim do foreach
      ?>
       
      Esse campo dc:creator eu não consigo ler. Como faço?
       
      Agradeço quem puder me ajudar.
       
      Abs
       
       
    • Por Mauricio Molina
      Ola pessoal, será que podem me dar uma força?
       
      Preciso fazer um calculo de subtração de valores, onde o administrador seleciona o mes, pego pelo ID, método GET, para edição.
       
      Como normalmente tem vários meses pagos, o script a seguir só esta funcionando no primeiro item da tabela.
       
      Como posso fazer para funcionar em todos os itens da tabela?
       
      Teria que dar um nome diferente no getValor (id no HTML) para cada um, mas como posso fazer isso?
       
      <!-- Calculo Devolucao--> <script type="text/javascript"> function id(valor_campo) { return document.getElementById(valor_campo); } function getValor(valor_campo) { var valor = document.getElementById(valor_campo).value.replace(',', '.'); /*document.write("Valor: " - valor);*/ return parseFloat( valor ) * 1; } function sub() { var total = getValor('v_recebido') - (getValor('v_devolvido')); id('resultadoDev').value = (total * 1) .toFixed(2, "."); } </script> <!-- Calculo Devolucao--> <div class="toggle"> <input name="v_devolvido" type="checkbox" id="foo<?php echo $rows_aluno['id']; ?>" value="<?php echo $rows_aluno['v_recebido']; ?>"> <label for="foo<?php echo $rows_aluno['id']; ?>"></label> </div> <input type="text" id="v_recebido" value="<?php echo $rows_aluno['v_recebido']; ?><?php echo $rows_aluno['v_receb_parc']; ?>" onblur="sub()" > <div class="form-row"> <div class="form-group col-md-6"> <label for="validationCustomUsername">Valor Parcial:</label> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text" id="inputGroupPrepend">R$</span> </div> <input name="v_dev_parc" type="text" class="form-control" id="v_devolvido" placeholder="Digite o Valor" aria-describedby="inputGroupPrepend" onblur="sub()"> </div> </div> <input name="id_user" type="hidden" value="<?php echo $rows_aluno['id_user']; ?>"> <input name="id_prof" type="hidden" value="<?php echo $rows_aluno['id_prof']; ?>"> <input name="status" type="hidden" value="Devolvido"> <input name="mes" type="hidden" value="<?php echo $rows_aluno['mes']; ?>"> <input name="v_recebido" type="text" id="resultadoDev"> </div>  
    • Por mateus.andriollo
      Boa tarde,
      Tenho alguns campos numéricos q ao fazer uma select gostaria q retornasse uma legenda
       
      exemplo:
      Status: 0=Inativo / 1=Ativo Condição: 1=Funcionando / 2=Em manutenção / 3=Manutenção Interna   
      Seria algo assim, tenho varias tabelas com estes campos... mas tenho q ficar usando replace.
      Existe uma forma de criar uma função para isso? Nem q na função eu tenha que setar nome do campo, ficando assim:
      Legenda('Status',cadastro.status) 
    • Por Sharank
      Strcat Function In C++
       
      I'm new to C and C++ programming, can anyone give me a hint on what I'm doing wrong here. I'm trying to write to concat function that takes to pointers to chars and concatenates the second to the first. The code does do that, but the problem is that it adds a bunch of junk at the end.
       
      For instance, when passing the arguments - "green" and "blue", the output will be "greenblue" plus a bunch of random characters. I also wrote the strlen function that strcat uses, which I will provide below it for reference. I'm using the online compiler at InterviewBit The exact instructions and specification is this:
       
      int main(int argc, char** argv)
      {
      const int MAX = 100;
       
      char s1[MAX];
      char s2[MAX];
       
      cout << "Enter your first string up to 99 characters. ";
      cin.getline(s1, sizeof(s1));
      int size_s1 = strlen(s1);
      cout << "Length of first string is " << size_s1 << "\n";
       
      cout << "Enter your second string up to 99 characters. ";
      cin.getline(s2, sizeof(s2));
      int size_s2 = strlen(s2);
      cout << "Length of second string is " << size_s2 << "\n";
      cout << " Now the first string will be concatenated with the second
      string ";
      char* a = strcat(s1,s2);
       
      for(int i = 0; i<MAX; i++)
      cout <<a;
       
      // system("pause");
      return 0;
      }
       
      //strcat function to contatenate two strings
      char* strcat(char *__s1, const char *__s2)
      {
      int indexOfs1 = strlen(__s1);
      int s2L = strlen(__s2);
      cout <<s2L << "\n";
      int indexOfs2 = 0;
      do{
      __s1[indexOfs1] = __s2[indexOfs2];
      indexOfs1++;
      indexOfs2++;
      }while(indexOfs2 < s2L);
       
       
      return __s1;
      }
       
      //Returns length of char array
      size_t strlen(const char *__s)
      {
      int count = 0;
      int i;
      for (i = 0; __s != '\0'; i++)
      count++;
      return (count) / sizeof(__s[0]);
       
      }
    • Por roberson abalaid
      #include <stdio.h>
      #include <stdlib.h>
      int arr[3][5];
      int main(){
          
          printf("Favor inserir os dados...\n");
          
          for(int i = 0; i < 3; i++){
              for(int j = 0; j < 5; j++){
                  scanf("%d", &arr[j]);
              }
          }
          
            printf("os valores inseridos foram...\n");
          
          for(int i = 0; i < 3; i++){
              for(int j = 0; j < 5; j++){
                  printf("  %d  ", arr[j]);
              }
              printf("\n");
          }
          return 0;
      }
×

Informação importante

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