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 Lenon John
      Detalhe importante:
      Se eu digito MINHA_CHAVE_JADLOG incorreta, ai eu recebo um retorno informado que as credenciais estão incorretas.
      Se eu digito MINHA_CHAVE_JADLOG corretamente, não recebo nenhum retorno.

      $dados = [
        'frete' => [
          'cepori' => '29010070',
          'cepdes' => '29300040',
          'frap' => '',
          'peso' => 2,
          'cnpj' => '00000000000100',
          'conta' => '000001',
          'contrato' => '',
          'modalidade' => 4,
          'tpentrega' => 'D',
          'tpseguro' => 'N',
          'vldeclarado' => 100,
          'vlcoleta' => ''
        ]
      ];
      $postfields = http_build_query($dados);
       
      $header = array();
      $header[] = 'Authorization: Bearer MINHA_CHAVE_JADLOG';
      $header[] = 'Content-Type: application/json';
      $header[] = 'description:';
       
      $curl = curl_init('https://www.jadlog.com.br/embarcador/api/frete/valor/');
      curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
      curl_setopt($curl, CURLOPT_POST, true);
      curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
       
      $exec = curl_exec($curl);
      $jadlog = json_decode($exec);
       
      curl_close($curl);
       
      print_r($jadlog);
    • 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 DuRodrig
      Pessoal, bom dia! 
      Estou fazendo uma página com um cálculo simples de porcentagem.
      Existe um formuário que coloco o valor da venda, a comissão é fixa em 13% e a tarifa é um valor que você coloca também.
      Exemplo: (valor da venda) R$ 100,00 - (comissão 13%) - (tarifa) R$ 8,50 = (resultado) R$ 78,50, só que está gerando o resultado de R$ 79,00.
      Como faço para corrgir esse problema?
      Segue o código:

       
      $(function(){ $('#valorVenda').on('input', function() { calculate(); }); $('#tarifa').on('input', function() { calculate(); }); function calculate(){ var pPos = parseFloat($('#valorVenda').val()); var tar = parseFloat($('#tarifa').val()); var result = " "; if(isNaN(pPos) || isNaN(tar)){ }else{ result = ((pPos - ((13.00 * pPos) / 100.00)) - tar).toFixed(2); } $('#total').val(result); } });  
      Desde já agradeço.
    • Por TkCode
      Estou tentando desenvolver um código para calcular o valor final de custas de imoveis.
      Exemplo: Entro com um valor de R$50.000,00. Tem o ITBI que é 2% sob os R$50.000,00 + o valor de custas que é o valor de uma tabela (essa tabela tem valores que de R$0,01 até R$17.800,90 é uma valor, e assim sucessivamente)
       
      Então teria que calcular os 2% (do valor informado) + o valor da tabela, dando um resultado final com o valor total (2%+ValorTabela).
       
      Alguem teria como me dar uma dica de como resolver isso?
      Desde já agradeço!
    • 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.