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...
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...
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,...
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...
Python Program Write a program that will ask a user on how many input colored balls...
Python Program Write a program that will ask a user on how many input colored balls of the following codes: R-red, B-blue, W-white, G-green and O-orange -will he or she would like to enter in the program and print the total number of Red balls were encountered. Assume an uppercase and lower case letter will be accepted.
Write a program in C, that uses standard input and output to ask the user to...
Write a program in C, that uses standard input and output to ask the user to enter a sentence of up to 50 characters, the ask the user for a number between 1 & 10. Count the number of characters in the sentence and multiple the number of characters by the input number and print out the answer. Code so far: char sentence[50]; int count = 0; int c; printf("\nEnter a sentence: "); fgets(sentence, 50, stdin); sscanf(sentence, %s;    for(c=0;...
Ask the user to input a series of numbers, write a C# program to output the...
Ask the user to input a series of numbers, write a C# program to output the sum, max, and min. Be sure to do error checking if the user input is not a number.
ASSIGNMENT: Write a program and use the attached file (babynames.txt) as input file, and create two...
ASSIGNMENT: Write a program and use the attached file (babynames.txt) as input file, and create two output tiles. One file listing out all boys names, and the other file listing out all girls name. CODE: (teacher gave some of the code below use it to find the answer please String B is the boy names String E is girl names) import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; /** This program reads a file with numbers, and writes the numbers...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT