Error showing a String

Asked

Viewed 30 times

0

I’m asking the question Entry and Exit with Comma, I’m doing everything the question asked but I’m leading 30% error, could help me where the error may be

My code

#include <stdio.h>
#include <string.h>
int main(int argc, char** argv)
{
   char nome[100], aux_1[90], aux_2[90];
   int i = 0, cont = 0;
   scanf("%[^\n]", nome);

   for(i = 0; i < nome[i] && nome[i] != ','; i++)
   {
      aux_1[i] = nome[i];
   }
   aux_1[i] = '\0';
   i++;
   for(int j = i; j < nome[j] && nome[j] != '\0'; j++)
   {
      aux_2[cont] = nome[j];
      cont++;
   }
    aux_2[cont] = '\0';
    puts(aux_1);
    puts(aux_2);
   return 0;
}
  • The challenge speaks of reading being done in multiple test "files" and the output is also in file. Is that not what is missing?

  • I just did what you told me to do with the end of the EOF file, but you’re still 30 %

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.