//flames using C
#include<stdio.h>
int main()
{
char name1[25],name2[25];
register int i,j;
static int count_fname,count_lname;
int sum=0;
char temp;
printf("\n Enter your name::");
scanf("%s",name1);
printf("\nEnter Miss/Mr 'X' Name::");
scanf("%s",name2);
i=0,j=0;
while(name1[i]!='\0') /*Sorting the first name*/
{
j=i+1;
while(name1[j]!='\0')
{
if(name1[i]>name1[j])
{
temp=name1[i];
name1[i]=name1[j];
name1[j]=temp;
}
j++;
}
i++;
count_fname=i;
}
printf("\n%s",name1);
i=0,j=0;
while(name2[i]!='\0') /*Sorting the second name*/
{
j=i+1;
while(name2[j]!='\0')
{
if(name2[i]>name2[j])
{
temp=name2[i];
name2[i]=name2[j];
name2[j]=temp;
}
j++;
}
i++;
count_lname=i;
}
printf("\n%s",name2);
i=0,j=0;
while(name1[i]!='\0' && name2[j]!='\0') /*Compare to get perfect count*/
{
if(name1[i]<name2[j])
{
i++;
}
else if(name1[i]>name2[j])
{
j++;
}
else if(name1[i]==name2[j])
{
count_fname=count_fname-1;
count_lname=count_lname-1;
i++;
j++;
}
}
printf("\n Value of count_fname:%d",count_fname);
printf("\n Value of count_fname:%d",count_lname);
sum=(count_fname+count_lname); //sum up remaining letters in two names*/
//sum=sum%6;
switch(sum)
{
case 0:
printf("\n Sorry Same Name found!!! else alike palindrome or anagram");
break;
case 1:
printf("\n -->Sister-->");
break;
case 2:
printf("\n -->Enemy-->");
break;
case 3:
printf("\n -->Friends-->");
break;
case 4:
printf("\n -->Enemy-->");
break;
case 5:
printf("\n -->Friends-->");
break;
case 6:
printf("\n -->You Gonna MARRY each other-->");
break;
case 7:
printf("\n -->Enemy-->");
break;
case 8:
printf("\n -->Affection-->");
break;
case 9:
printf("\n -->Enemy-->");
break;
case 10:
printf("\n Love");
case 11:
printf("\n You Gonna MARRY each other");
break;
case 12:
printf("\n Affection");
break;
case 13:
printf("\n Affection");
break;
case 14:
printf("\n Friends");
break;
case 15:
printf("\n You gonna marry each other");
break;
case 16:
printf("\n Friends");
break;
}
return 0;
}
#include<stdio.h>
int main()
{
char name1[25],name2[25];
register int i,j;
static int count_fname,count_lname;
int sum=0;
char temp;
printf("\n Enter your name::");
scanf("%s",name1);
printf("\nEnter Miss/Mr 'X' Name::");
scanf("%s",name2);
i=0,j=0;
while(name1[i]!='\0') /*Sorting the first name*/
{
j=i+1;
while(name1[j]!='\0')
{
if(name1[i]>name1[j])
{
temp=name1[i];
name1[i]=name1[j];
name1[j]=temp;
}
j++;
}
i++;
count_fname=i;
}
printf("\n%s",name1);
i=0,j=0;
while(name2[i]!='\0') /*Sorting the second name*/
{
j=i+1;
while(name2[j]!='\0')
{
if(name2[i]>name2[j])
{
temp=name2[i];
name2[i]=name2[j];
name2[j]=temp;
}
j++;
}
i++;
count_lname=i;
}
printf("\n%s",name2);
i=0,j=0;
while(name1[i]!='\0' && name2[j]!='\0') /*Compare to get perfect count*/
{
if(name1[i]<name2[j])
{
i++;
}
else if(name1[i]>name2[j])
{
j++;
}
else if(name1[i]==name2[j])
{
count_fname=count_fname-1;
count_lname=count_lname-1;
i++;
j++;
}
}
printf("\n Value of count_fname:%d",count_fname);
printf("\n Value of count_fname:%d",count_lname);
sum=(count_fname+count_lname); //sum up remaining letters in two names*/
//sum=sum%6;
switch(sum)
{
case 0:
printf("\n Sorry Same Name found!!! else alike palindrome or anagram");
break;
case 1:
printf("\n -->Sister-->");
break;
case 2:
printf("\n -->Enemy-->");
break;
case 3:
printf("\n -->Friends-->");
break;
case 4:
printf("\n -->Enemy-->");
break;
case 5:
printf("\n -->Friends-->");
break;
case 6:
printf("\n -->You Gonna MARRY each other-->");
break;
case 7:
printf("\n -->Enemy-->");
break;
case 8:
printf("\n -->Affection-->");
break;
case 9:
printf("\n -->Enemy-->");
break;
case 10:
printf("\n Love");
case 11:
printf("\n You Gonna MARRY each other");
break;
case 12:
printf("\n Affection");
break;
case 13:
printf("\n Affection");
break;
case 14:
printf("\n Friends");
break;
case 15:
printf("\n You gonna marry each other");
break;
case 16:
printf("\n Friends");
break;
}
return 0;
}
No comments:
Post a Comment