Home > Back-end >  C language contest questions how to solve
C language contest questions how to solve

Time:11-28

A very simple question, the question how to write, characters of knowledge completely forget, I remember STRCHR is used to write, but didn't write out good intention person to help me

CodePudding user response:

No man or woman??

CodePudding user response:

This didn't also difficult, write their own good? Too lazy.

CodePudding user response:

Show a, only supplies the reference:
 # include & lt; stdio.h> 
# include & lt; string.h>

Int yes_or_no (int) c
{
int result=0;
If (c=='a' | | c=='e' | | c=='I' | | c=='o' | | c=='u') result=1;
Else if (c=='A' | | c=='E' | | c=='I' | | c=='O' | | c=='U') result=1;
return result;
}

Int main (void)
{
Char buf [1001].
Char * p;

While (the fgets (buf, sizeof (buf), stdin))
{
If (STRCMP (buf, "end \ n")==0 | | STRCMP (buf, "end of \ r \ n")==0) break;

P=buf.
While (* p!='\ 0')
{
If (yes_or_no (* p)==1) printf (" % c ", * p);
p++;
}
printf("\n");
}

return 0;
}

CodePudding user response:

reference ctrigger reply: 3/f
this didn't also difficult, write their own good? Too lazy,

Not lazy, I am have not learned the content here...

CodePudding user response:

 
Void out (const char * const STRS, char * out)
{
Each character traversal STRS
If the current character is a vowel characters
Saved to the array out
Traverse end

O
}

Write their own

CodePudding user response:

reference 4 floor ctrigger response:
show a, only supplies the reference:
 # include & lt; stdio.h> 
# include & lt; string.h>

Int yes_or_no (int) c
{
int result=0;
If (c=='a' | | c=='e' | | c=='I' | | c=='o' | | c=='u') result=1;
Else if (c=='A' | | c=='E' | | c=='I' | | c=='O' | | c=='U') result=1;
return result;
}

Int main (void)
{
Char buf [1001].
Char * p;

While (the fgets (buf, sizeof (buf), stdin))
{
If (STRCMP (buf, "end \ n")==0 | | STRCMP (buf, "end of \ r \ n")==0) break;

P=buf.
While (* p!='\ 0')
{
If (yes_or_no (* p)==1) printf (" % c ", * p);
p++;
}
printf("\n");
}

return 0;
}

Yes thank you, excuse me that while the fgets () inside the stdin is what meaning of the sentence, and the sizeof (what inside

CodePudding user response:

refer to 7th floor m0_46868677 response:
yes thank you, excuse me that while the fgets () inside the stdin is what meaning of the sentence, and inside of the sizeof (what


Standard input stdin: file pointer, said,
The size of the sizeof: calculate character array buf,
  • Related