1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
//This codes is all about flames
#include<iostream>
#include<string.h>
#include<stdlib.h>
using namespace std;
int main()
{
int x,y,z,i,j,r,s;
char choice, boy[22],girl[22],a[11]={' ','f','l','a','m','e','s'},b[11];
do
{
//input the names
cout<<"\nEnter the name of the boy: \n"<<endl;
cin>>boy;
cout<<"\nEnter the name of the girl: \n"<<endl;
cin>>girl;
x=strlen(boy);
y=strlen(girl);
z=x+y;
//eliminating the letters of the two string
for(i=0; i<x; i++)
{
for(j=0; j<y; j++)
{
if(boy[i]==girl[j]) //for comparing the names
{
boy[i]=girl[j]=' ';
z=z-2;
break;
}
}
}
//eliminating the letters of FLAMEs
for(r=6;r>1;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-1;i++)
{
a[i]=b[i];
}
}
//the result
cout<<"\nRelationship status: \n"<<endl;
switch(a[1])
{
case 'f':
cout<<"FRIENDSHIP";
break;
case 'l':
cout<<"LOVE";
break;
case 'a':
cout<<"AFFECTION";
break;
case 'm':
cout<<"MARRIAGE";
break;
case 'e':
cout<<"ENEMY";
break;
case 's':
cout<<"SIBLINGS";
break;
}
cout<<endl<< "\nDo you wish to repeat the game?(y/n): \n"<<endl;
cin>>choice;
system("CLS");
if(choice=='N' || choice== 'n')
{
cout<< "\t\tThank you for trying! Good bye! \n"<<endl;
}
}
while(choice=='y' || choice=='Y');
return 0;
}
|