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
Q1 Create a program that asks the user to input their budget. Then, it will ask...
Q1 Create a program that asks the user to input their budget. Then, it will ask the user to input each of their purchase until their entire budget is used up. What kind of loop do you think is the most appropriate? You don't have to create the entire program. Part of it has already been created for you (see code below). Note: Assume that the user always uses up their budget to the last cent and they don't over...
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...
Use C++ language Create a program which will ask the user to input three songs for...
Use C++ language Create a program which will ask the user to input three songs for a playlist (you may use TV shows or movies, if you prefer). Declare three strings to store each of the songs. Use getline to receive the input. Display output which lists each of the songs (or movies or tv shows), on separate lines, with a title on the first line: My Playlist. Insert three lines of comments at the beginning of the program for...
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,...
Create a program that asks the user for two positive integers. If the user's input for...
Create a program that asks the user for two positive integers. If the user's input for either integer is not positive (less than or equal to 0), re-prompt the user until a positive integer is input. You may assume that all inputs will be integers. Print out a list, ascending from 1, of all divisors common to both integers. Then, print out a message stating whether or not the numbers are "relatively prime" numbers. Two positive integers are considered relatively...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT