FLAMES Game
C Code:
#include<stdio.h>
#include <stdlib.h>
#include<string.h>
int main()
{
int x,y,z,i,j,r,g,h,s;
char name1[100],name2[100],a[11]={' ','f','l','a','m','e','s'},b[11];
scanf("%s",name1);
scanf("%s",name2);
x=strlen(name1);
y=strlen(name2);
z=x+y;
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
if(tolower(name1[i])==tolower(name2[j]))
{
name1[i]=name2[j]=' ';
z=z-2;
break;
}
}
}
for(r=6;r>0;r--)
{
s=z%r;
if(s==0)
{
s=r;
i=1;
}
else
{
a[s]='/0';
i=s+1;
}
j=1;
while(1)
{
if(i==s)
{
break;
}
b[j]=a[i];
if(i==r)
{
i=0;
}
i++;
j++;
}
for(i=1;i<=r;i++)
{
a[i]=b[i];
}
}
switch(a[1])
{
case 'f':printf("FRIENDS");break;
case 'l':printf("LOVER");break;
case 'a':printf("AFFECTION");break;
case 'm':printf("MARRIAGE");break;
case 'e':printf("ENEMY");break;
case 's':printf("SIBLING");break;
}
}
#include <stdlib.h>
#include<string.h>
int main()
{
int x,y,z,i,j,r,g,h,s;
char name1[100],name2[100],a[11]={' ','f','l','a','m','e','s'},b[11];
scanf("%s",name1);
scanf("%s",name2);
x=strlen(name1);
y=strlen(name2);
z=x+y;
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
if(tolower(name1[i])==tolower(name2[j]))
{
name1[i]=name2[j]=' ';
z=z-2;
break;
}
}
}
for(r=6;r>0;r--)
{
s=z%r;
if(s==0)
{
s=r;
i=1;
}
else
{
a[s]='/0';
i=s+1;
}
j=1;
while(1)
{
if(i==s)
{
break;
}
b[j]=a[i];
if(i==r)
{
i=0;
}
i++;
j++;
}
for(i=1;i<=r;i++)
{
a[i]=b[i];
}
}
switch(a[1])
{
case 'f':printf("FRIENDS");break;
case 'l':printf("LOVER");break;
case 'a':printf("AFFECTION");break;
case 'm':printf("MARRIAGE");break;
case 'e':printf("ENEMY");break;
case 's':printf("SIBLING");break;
}
}
Comments
Post a Comment