Home > Back-end >  C at the end of the match
C at the end of the match

Time:11-25

Inquire of god this c + + problem zha

CodePudding user response:

Fyi:
 # include & lt; Stdio. H> 
#include
#include

# define LEN 1001

Int str_case_cmp (char * SRC, char * DST)
{
for(; The toupper (* SRC)==toupper (* DST); Src++ dst++)
{
If (* SRC=https://bbs.csdn.net/topics/='\ 0') return 0;
}

SRC - return * * DST;
}


Int main (void)
{
Int result;
Char SRC/LEN, DST (LEN);

The fgets (SRC, LEN, stdin);
The fgets (DST, LEN, stdin);

If (strlen (SRC) & lt;=strlen (DST))
{
If (str_case_cmp (SRC, DST - strlen (SRC) + strlen (DST))==0) result=1;
The else result=0;
}
The else
{
If (str_case_cmp (SRC + strlen (SRC) - strlen (DST), DST)==0) result=1;
The else result=0;
}

Printf (" % s \ n ", the result==1? "True" : "False");

return 0;
}
  • Related