Ir para conteúdo

Arquivado

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

m

Como separar uma string sem biblioteca?

Recommended Posts

Sou iniciante em c e preciso transformar um num. romano em numero decimal mas não posso usar nenhuma biblioteca o função alem de for, while, strcmp, e if basicamente. 

Compartilhar este post


Link para o post
Compartilhar em outros sites

  • Conteúdo Similar

    • Por Leandro T.
      pessoal bom dia alguém poderia me ajudar com o FormValidation?
       
      "nomefuncionario": {
                  validators: {
                      
                  
                    notEmpty: {
                      message: "Nome completo do funcionário é obrigatório."
                    } , <=== este funciona normalmente
                      
                      callback: {  // agora o callback nao consigo fazer funcionar
                              message: 'este nome não é valido',
                              callback: function (input) {
                                  if (input.value = 'algum valor digitado') {
                                      return true
                                  } }},
                      
                      
                      
                  }
    • Por nathanmoreira
      Após diversos cálculos provindos de um código, recebo um número inteiro ao qual não sei o tamanho ao certo (pode variar de 1 pra frente). Quero passar esse número para string e formatar ele de maneira a colocar um ,00 no final e, a cada 3 números antes da virgula, um ponto. Ou seja, deixar o número num formato como: 45.114.477,00
       
      Como fazer? 
    • Por TK_T
      olá sou iniciante consegui fazer um o código de um exercício só que quando eu peço o valor 12ab ele lê como numérica alguém pode me ajudar? 
      Exercício: Leia uma string e diga se a mesma é numérica (na base decimal) ou não.
      Ex.: "123" -> numérica
      "abc" -> não numérica
      "12ab" -> não numérica
      "12.34" -> numérica 
      #include <stdio.h> int main() { char Numero; printf("Digite Algo: "); scanf("%c", &Numero); if(Numero == '1' || Numero == '2' || Numero == '3' || Numero == '4' || Numero == '5' || Numero == '6' || Numero == '7' || Numero == '8' || Numero== '9' || Numero == '0') printf("\tNumérica...\n"); else printf("\tNão Numérica\n"); return 0; }  
    • Por clayton.lima2020
      Boa Tarde!
       
      Pessoal estou com um problema para resolver:
       
      Tenho um uma string que é um Nome:  SYLVIA
       
      Eu preciso fazer uma uma busca nessa string achar a letra Y e depois verificar se após a letra Y a próxima letra é Vogal ou Consoante.
       
      No caso do nome SYLVIA a próxima letra é L então retorna Consoante.
       
      Alguém sabe montar esse algoritmo ai?
    • 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]);
       
      }
×

Informação importante

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