Re: 490 - Rotating Sentences why? WA please help me
Posted: Sat Jan 07, 2012 6:17 am
Hi brianfry713,
Thank you very much for kindly help.
Now, it's still WA. Please, tell me where is the problem in my code. Here is my modified code.
Thank you very much for kindly help.
Now, it's still WA. Please, tell me where is the problem in my code. Here is my modified code.
Code: Select all
#include<stdio.h>
#include<string.h>
int main()
{
while(true)
{
char s1[101]={'\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0'};
char s2[101]={'\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0'};
int max,len1,len2;
gets(s1);
len1=strlen(s1);
if(s2[0]=='\0' && s1[0]!='\0')
{
gets(s2);
len2=strlen(s2);
}
if(s2[0]=='\0' && s1[0]=='\0') break;
if(len1>len2)
{
max=len1;
}
else if(len2>len1)
{
max=len2;
}
else
max=len1;
int fag=0;
for(int i=0 ; i<max ; i++)
{
printf("%c%c\n",s2[i],s1[i]);
//if(i<max-1) printf("\n");
fag++;
}
if(fag!=0)
{
for(int i=0 ; i<max ; i++)
{
s2[0]='\0';
}
}
}
return 0;
}