Question

In: Computer Science

Create a program that ask to input two users and the result will vary on their...

Create a program that ask to input two users and the result will vary on their name with similar digits. In a game of F.L.A.M.E.S , it will count and repeat depends on their name that has a similar digit. For an Example (JOE RIZAL) and (JACKLYN BRACKEN) - JOE RIZAL has - 5 similar digits , while JACKLYN BRACKEN has 6 similar digits so a total of 11.

F - Friends - 1,7

L - Lover - 2,8

A - Anger - 3,9

M - Married - 4,10

E - ENEMY - 5,11 - therefore joe rizal and jacklyn are soulmate

S - SOULMATE - 6

use looping , switch statement , toupper , tolower , string , swap and much more...

// SAMPLE OUTPUT //

INPUT YOUR FULLNAME: JOE RIZAL

INPUT YOUR PARTNER FULL NAME: JACKLYN BRACKEN

RESULTS: JOE RIZAL AND JACKLYN BRACKEN ARE ENEMY.

Solutions

Expert Solution

#include<iostream>
#include<string.h>
#include<ctype.h>
using namespace std;
int main()
{
   int count1=0,count2=0,count;
   string s1,s2;
   cout<<"Enter first name\t";
   getline(cin,s1);
   cout<<"enter second name\t";
   getline(cin,s2);
   int len1= s1.length();
   int len2= s2.length();
   for(int i=0;i<len1;i++)
   {
       if(islower(s1[i]))
           s1[i]=toupper(s1[i]);
       for(int j=0;j<len2;j++)
       {
           if(islower(s2[j]))
           s2[j]=toupper(s2[j]);
           if(s1[i]==s2[j])
           {
               ++count1;
               break;
           }
       }
   }
   for(int i=0;i<len2;i++)
   {
       if(islower(s2[i]))
           s2[i]=toupper(s2[i]);  
       for(int j=0;j<len1;j++)
       {
           if(islower(s1[j]))
           s1[j]=toupper(s1[j]);
           if(s2[i]==s1[j])
           {
               ++count2;
               break;
           }
       }
   }
   count1--;//space is also counted, so decrease one.
   count2--;//space is also counted so decrease one.
   count=count1+count2;
   if(count==0){
   cout<<"NO MATCH FOUND";
   }
   else{
   count=(count%6);
   switch(count)
   {
       case 1:
               cout<<"FRIENDS";
               break;
              
       case 2:
               cout<<"LOVER";
               break;
      
       case 3:
               cout<<"ANGER";
               break;
      
       case 4:
               cout<<"MARRIED";
               break;
      
       case 5:
               cout<<"ENEMY";
               break;
      
       case 0:
               cout<<"SOULMATE";
               break;
   }
   }
}

OUTPUT:

Enter first name JOE rizal
enter second name JACKlyn bracKEN
ENEMY
--------------------------------
Process exited after 29.72 seconds with return value 0
Press any key to continue . . .


Related Solutions

Create a small program that contains the following. ask the user to input their name ask...
Create a small program that contains the following. ask the user to input their name ask the user to input three numbers check if their first number is between their second and third numbers
I'm making a python program that checks the users input. If the users input does not...
I'm making a python program that checks the users input. If the users input does not match the rules then the program will output "No". If the users input does match the rules it will output "Yes". The rules are : at least 5 uppercase letters at least 5 lowercase letters at least 5 numbers No more than 20 characters in total I have managed to meet these conditions in individual python files but not in one. Ideally without importing...
I'm making a python program that checks the users input. If the users input does not...
I'm making a python program that checks the users input. If the users input does not match the rules then the program will output "No". If the users input does match the rules it will output "Yes". The rules are : 5 uppercase letters 5 lowercase letters 5 numbers First letter must be capitilized The total characters must be 15 I have managed to meet these conditions in individual python files but not in one. Ideally without importing anything, still...
Design a program that will ask the user to input two integer numbers and then perform...
Design a program that will ask the user to input two integer numbers and then perform the basic arithmetic operations such as addition and subtraction. Each calculation is done by a separate function. The main function gets the input from the user, then calls the addition function and the subtraction function one at a time to perform the calculations. Each calculation function (addition or subtraction function) performs an arithmetic operation and then returns the calculation results back to where it...
Question: Conversion Program * This program will ask the user to input meters * After input,...
Question: Conversion Program * This program will ask the user to input meters * After input, a menu will be displayed: * 1. Convert to kilometers * 2. Convert to inches * 3. Convert to feet * 4. Quit * * The user will select the conversion and the converted answer will be displayed. * The program should redisplay the menu for another selection. * Quit program when user selects 4. Hi, my instructor requirement fix the bug in the...
using C language Create a bitwise calculator that ask user for input two input, first int,...
using C language Create a bitwise calculator that ask user for input two input, first int, bitwise operation, second int (i.e 5 & 9) only those bitwise operation are allowed: & ~ ^ | << >>. If user uses wrong operators stop program and ask again. Convert the first int and second int into 8 BITS binary (00000000) and use bitwise operator given by user to either AND, OR, XOR, etc (ie 1001 & 1111)
Write a program that will ask for the user to input a filename of a text...
Write a program that will ask for the user to input a filename of a text file that contains an unknown number of integers. And also an output filename to display results. You will read all of the integers from the input file, and store them in an array. (You may need to read all the values in the file once just to get the total count) Using this array you will find the max number, min number, average value,...
I need someone to create a program for me: Create a program that takes as input...
I need someone to create a program for me: Create a program that takes as input an employee's salary and a rating of the employee's performance and computes the raise for the employee. The performance rating here is being entered as a String — the three possible ratings are "Outstanding", "Acceptable", and " Needs Improvement ". An employee who is rated outstanding will receive a 10.2 % raise, one rated acceptable will receive a 7 % raise, and one rated...
Using Python and Kivy to create a App to ask users 5 questions with Yes or...
Using Python and Kivy to create a App to ask users 5 questions with Yes or No button. 1. Are you older than 14? 2. Did you pass 8th or 9th Grade? 3. Are you ready gor highschool? 4. Do you have 4 more years to complete highschool? 5. Are you homeschool? If the users click Yes for 3 questions or more than you should get a results page saying this users is in highschool or else the user is...
Create a program (Python) YourFirstnameLastnameA06b.py to ask the user to create a password: The user will...
Create a program (Python) YourFirstnameLastnameA06b.py to ask the user to create a password: The user will first enter a password, then enters the same password again; If the second input is the same as first one, the user successfully creates the password. Print “Well done.”; Otherwise, the user will be directed to repeat the whole process (go to step 1.)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT