Answer to Question #26894 in C++ for jaymer

Question #26894
Write a program to ask the user to input the name of boy and name of girl. Count the number of common letters to their names and add them up. Determine the corresponding equivalent using the games FLAMES. (F = riends, L = Lovers, A = Angry, M = arriage , E = Enemies, S = Sweet)
1
Expert's answer
2013-03-27T09:07:17-0400
#include <iostream>
#include <string>
using namespace std;

int main(){
string _flames[] = {"Friends", "Lovers", "Angry", "Marriage", "Enemies", "Sweet"};
string _boy, _girl;
int _common = 0;
cout<<"Input the name of boy:";
cin>>_boy;
cout<<"Input the name of girl:";
cin>>_girl;
& for ( int i = 0; i < _girl.length(); i++ )
& {
& _common += count(_boy.begin(), _boy.end(), _girl[i]);
& }
cout<<_flames[_common%6]<<endl;
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS