1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Natali [406]
3 years ago
15

Assign True to the variable has_dups if the string s1 has any duplicate character (that is if any character appears more than on

ce) and False otherwise.
Computers and Technology
1 answer:
podryga [215]3 years ago
4 0

Answer:

#include <iostream>

using namespace std;

int main()

{

   string s;

   cin>>s;    //reading string

   int i,j;

   bool has_dups=false;

   int n= s.length();

   for(i=0;i<n;i++)  //to check for duplicate characters

   {

       for(j=0;j<n;j++)

       {

           if(j!=i && s[i]==s[j])  //to check if it is matched with itself

           {

               has_dups=true;  //if true no need to check others

               break;

           }

       }

   }

   cout<<has_dups;

   return 0;

}

OUTPUT :

California

1

Explanation:

Above program finds if a character repeat itself in the string entered by user.

You might be interested in
Suppose you are the security manager of a company and one of your goals is to design security mechanisms based on three security
Tcecarenko [31]

Answer:

(i) Prevention is more important than detection and recovery.

(ii) Detection is more important than prevention and recovery.

(iii) Recovery is more important than prevention and detection.

Explanation:

(i) Prevention is more important than detection and recovery.

Prevention of attack can be through various applications for example a walk through gates are placed in order to prevent any attacker from entering the premises and causing harm.

(ii) Detection is more important than prevention and recovery.

Detection of an attack can be done through for example a security alarm can detect an attack and inform others.

(iii) Recovery is more important than prevention and detection.

Recovery of an attack can be done by for example an insurance which will recover a portion of loss occurred during the attack.

8 0
3 years ago
Write an application that prompts a user for a month, day, and year. Display a message that specifies whether the entered date i
gizmo_the_mogwai [7]

Answer:

Following is given the code with all necessary description given as comments in it. I hope it will help you!

Explanation:

4 0
3 years ago
What does Boot Partition mean?
lukranit [14]

Answer:The system partition and the boot partition are computing terms for disk partitions of a hard disk drive or solid-state drive that must exist and be properly configured for a computer to operate. There are two different definitions for these terms: the common definition and the Microsoft definition. - Wikipedia.

Explanation:

8 0
3 years ago
You work at a call center of a large bank where you answer credit card services related questions from customers. Lately, you ha
Sati [7]
The awnser is true I think
7 0
3 years ago
Read 2 more answers
Which is the most common drive letter where Windows stores most data and programs? A. B. C. E.
Effectus [21]

The most common drive letter where Windows stores most data and programs is "C".<span>
<span>In the beginning the computers used to have two floppy drives which were named as A and B. Later when hard drives added up to the technology, it was written as "C" because A and B were floppy drives already :) </span></span>

4 0
3 years ago
Read 2 more answers
Other questions:
  • List and define the types of System Software. How does System Software differ from Applications Software?
    12·1 answer
  • Use System.DateTime along with System.Console to implement a simple C# program that does the following:_______.
    5·1 answer
  • Which statements are true about making formatting changes to cells in Excel? (Select all that apply)
    11·1 answer
  • What does zooming do? A. Changes your view of the Frame Editor to be closer or farther away B. Changes your view of the Event Ed
    12·1 answer
  • What is the difference between a key and a superkey?
    10·1 answer
  • Que es pilar en tecnologia
    11·1 answer
  • True/False - According to CP-14 Sale of Modular Homes, a licensee who sells land and a modular home to be affixed to the land, t
    11·1 answer
  • You are required to copy in your attendees' emails from outside of Outlook when creating a meeting
    6·2 answers
  • The printer prints 16 pages every minute. How many pages are printed in 6 minutes?
    14·2 answers
  • True or False? The background color block should be inserted after all the images are added.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!